ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code that Exits on certain Dates (https://www.excelbanter.com/excel-programming/421305-code-exits-certain-dates.html)

Seanie

Code that Exits on certain Dates
 
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

Chip Pearson

Code that Exits on certain Dates
 
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)


On Sun, 14 Dec 2008 11:31:50 -0800 (PST), Seanie
wrote:

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


Seanie

Code that Exits on certain Dates
 
Thanks Chip



All times are GMT +1. The time now is 11:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com