|
对于第2个问题,我试编写了一段程序,希望对你有帮助,同时请各位大虾指正。
Private Sub JiSuanZhouMo()
Dim datFhRq As Date '当前日期
Dim datShRq As Date '收货日期
Dim datSjDhRq As Date '实际运输到货日期
Dim intYsTs As Integer '运输天数
datFhRq = Date
'输入运输天数
intYsTs = InputBox(Prompt:="请输入运输天数:", Title:="运输天数", XPos:=2000, YPos:=2000)
'计算实际运输到货日期
datSjDhRq = datFhRq + intYsTs
'判断是否为周末
If Weekday(datSjDhRq, vbMonday) = 6 Then '是周六
datShRq = datSjDhRq + 2
ElseIf Weekday(datSjDhRq, vbMonday) = 7 Then '是周日
datShRq = datSjDhRq + 1
Else '不是周末
datShRq = datSjDhRq
End If
'输出实际收货日期
Debug.Print "今天发货日期:" & Date
Debug.Print "运输天数:" & intYsTs
Debug.Print "实际收货日期:" & datShRq
End Sub
|
|