Hello all:
I have an MS Word 2003 document with two VBA text boxes. In one (txtDate) is displayed the current time. The other (txtAfterHrs)is to be blank unless the current time is "after hours". The time displayed in "txtDate" is subject to change by another control in the Word doc, which is why I have the code under a "change" routine.
My problem is that my code worked for a while, and now it does not? I'm thinking I have a syntax error here. Here's the code:
Did I miss something? It seems to be pretty straightforward.
Any help would be most appreciated.
I have an MS Word 2003 document with two VBA text boxes. In one (txtDate) is displayed the current time. The other (txtAfterHrs)is to be blank unless the current time is "after hours". The time displayed in "txtDate" is subject to change by another control in the Word doc, which is why I have the code under a "change" routine.
My problem is that my code worked for a while, and now it does not? I'm thinking I have a syntax error here. Here's the code:
Code:
Private Sub txtDate_Change()
'This statement controls the *after hours* text box
If txtDate.Value > #4:46:00 PM# And txtDate.Value < #7:59:00 AM# Then
txtAfterHrs.Value = "**After Hours**"
Else
txtAfterHrs.Value = ""
End If
End Sub
Did I miss something? It seems to be pretty straightforward.
Any help would be most appreciated.