Code that Exits on certain Dates

S

Seanie

I have some code that executes when a file is opened. What code could
I introduce that would exit if Today()= 15/12/08 or 16/12/08 or
17/12/08?

An ideal extension of the above would be on 15/12 or 16/12 or 17/12 in
any year (just so that I can future proof my code)

Thanks
 
C

Chip Pearson

In the ThisWorkbook code module, use code like

Private Sub Workbook_Open()
If (Month(Now) = 12) And _
(Day(Now) >= 15) And (Day(Now) <= 17) Then
Exit Sub
End If
'''''''''''''
' code to run other days goes here
'''''''''''''
End Sub


Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
Top