PC Review


Reply
Thread Tools Rate Thread

Code that Exits on certain Dates

 
 
Seanie
Guest
Posts: n/a
 
      14th Dec 2008
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
 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      14th Dec 2008
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
<(E-Mail Removed)> 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

 
Reply With Quote
 
Seanie
Guest
Posts: n/a
 
      14th Dec 2008
Thanks Chip

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: code for between dates John Spencer MVP Microsoft Access VBA Modules 1 21st Apr 2009 12:49 AM
Run code automatically when last user exits? =?Utf-8?B?bXNjZXJ0aWZpZWQ=?= Microsoft Access Form Coding 5 16th Sep 2007 05:04 PM
Run code automatically when last user exits? =?Utf-8?B?bXNjZXJ0aWZpZWQ=?= Microsoft Access Form Coding 1 1st Jun 2007 04:20 PM
Code using Dates =?Utf-8?B?RGF2aWQgTSBD?= Microsoft Access VBA Modules 1 5th Sep 2006 04:01 PM
Scheduled Task Runs, and exits on code 0xc0000142 BGMike Windows XP General 2 15th Aug 2006 03:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:00 PM.