我正在使用ElseIf
聲明和系統日期來創建輸出。如果當前日期聲明
這是到目前爲止我的代碼:
Dim dateToday As Date
Dim fifth As Integer
Dim fifthteenth As Integer
Dim twentyEighth As Integer
Dim thirtieth As Integer
dateToday = Today
fifth = 5
fifthteenth = 17 'this is changed to todays date for testing otherwise its 15
twentyEighth = 28
thirtieth = 30
If fifth = dateToday Then
MsgBox ("Today is the fifth")
ElseIf fifthteenth = dateToday Then
MsgBox ("Today is the fifthteenth")
ElseIf twentyEighth = dateToday Then
MsgBox ("Today is the 28th")
ElseIf thirtieth = dateToday Then
MsgBox ("Today is the 30th")
Else
MsgBox ("You do not need to do anything yet")
End If
據直行至年底,併產生最後的消息框。
使用'選項Explicit'在頂部您模塊能夠在未來迅速消除這些錯誤。 –