Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 202
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 202
Default Code that Exits on certain Dates

Thanks Chip

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find if value exits in array Glynn Excel Worksheet Functions 6 September 5th 08 08:46 PM
Spacebar Exits Macro Zone[_2_] Excel Programming 6 December 31st 06 07:15 PM
Sub Exits Unexpectedly Walker Excel Programming 4 July 25th 05 10:43 PM
way to run sub after user exits textbox funkymonkUK[_50_] Excel Programming 2 July 12th 05 01:10 PM
graceful exits Bryan[_12_] Excel Programming 3 November 23rd 04 07:56 PM


All times are GMT +1. The time now is 04:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"