CraigG
Board Regular
- Joined
- May 1, 2005
- Messages
- 165
- Office Version
- 365
- 2007
- Platform
- Windows
- Mobile
Hi,
I have the following code:
Private Sub Workbook_Open()
Doit
End Sub
Sub Doit()
MyDate = Date - #12/31/2016#
If Date > MyDate Then
MsgBox "This workbook is closed"
ThisWorkbook.Close False
End If
End Sub
Can anyone help me where I'm going wrong? It gives the message box even if the date is in the future, eg, 31 December 2016 (which is after today 22 May 2015). I only want the message once the date has past.
Thanks.
I have the following code:
Private Sub Workbook_Open()
Doit
End Sub
Sub Doit()
MyDate = Date - #12/31/2016#
If Date > MyDate Then
MsgBox "This workbook is closed"
ThisWorkbook.Close False
End If
End Sub
Can anyone help me where I'm going wrong? It gives the message box even if the date is in the future, eg, 31 December 2016 (which is after today 22 May 2015). I only want the message once the date has past.
Thanks.