This checks the date and if it is the one listed in the code it runs the code!
It works by checking the date each time the workbook is opened!
Private Sub Workbook_Open()
'This code go's into the "ThisWorkbook" module.
Dim myTime
myTime = Time
'If today is older than the date below run:
If Now() >= #9/20/2004# Then
MsgBox "Time is Up!"
End If
'If the time is between the times below run:
If Time >= "6:00:00 PM" And Time <= "6:35:00 PM" Then
myMsg = MsgBox(prompt:="The current System-Time is:" & _
vbCr & vbCr & " " & _
FormatDateTime(myTime, vbLongTime) & vbCr & vbCr & vbCr & _
" and, ""Today"" is:" & vbCr & vbCr & _
FormatDateTime(Date, vbLongDate) & vbCr & vbCr, Title:=Now())
End If
End Sub
Sub Test()
Dim myTime
myTime = Time
'If today is older than the date below run:
If Now() >= #9/20/2004# Then
MsgBox "Time is Up!"
End If
'If the time is between the times below run:
If Time >= "6:00:00 PM" And Time <= "6:35:00 PM" Then
myMsg = MsgBox(prompt:="The current System-Time is:" & _
vbCr & vbCr & " " & _
FormatDateTime(myTime, vbLongTime) & vbCr & vbCr & vbCr & _
" and, ""Today"" is:" & vbCr & vbCr & _
FormatDateTime(Date, vbLongDate) & vbCr & vbCr, Title:=Now())
End If
End Sub
Sub myDT()
Dim myTime
myTime = Time
'If today is older than the date below run:
If Now() >= #9/20/2004# Then
MsgBox "Time is Up!"
End If
myMsg = MsgBox(prompt:="The current System-Time is:" & _
vbCr & vbCr & " " & _
FormatDateTime(myTime, vbLongTime) & vbCr & vbCr & vbCr & _
" and, ""Today"" is:" & vbCr & vbCr & _
FormatDateTime(Date, vbLongDate) & vbCr & vbCr, Title:=Now())
End Sub