PC Review


Reply
 
 
Elton Law
Guest
Posts: n/a
 
      4th May 2009
Dear Expert,
Have asked for time marco before.
Just wonder how to write the date marco in VB please ?
Say want to run on 5 May 9:00 AM please ?
Thanks


 
Reply With Quote
 
 
 
 
Nigel
Guest
Posts: n/a
 
      4th May 2009
Using these two procedures, Start will initiate the run when it is 9am, in
my_date if the date is 5th May 09 then code will run, else Start is re-run
to wait for 9am next day.

Sub Start()
Application.OnTime TimeValue("09:00:00"), "my_date"
End Sub

Sub my_date()
If Date <> DateSerial(2009, 5, 5) Then
Start
Exit Sub
End If

'your code to run at 9am on 5/5/09

End Sub

--

Regards,
Nigel
(E-Mail Removed)



"Elton Law" <(E-Mail Removed)> wrote in message
news:702DECCC-909B-4C23-A8A3-(E-Mail Removed)...
> Dear Expert,
> Have asked for time marco before.
> Just wonder how to write the date marco in VB please ?
> Say want to run on 5 May 9:00 AM please ?
> Thanks
>
>


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      4th May 2009
First, I would read Chip Pearson's notes:
http://www.cpearson.com/excel/OnTime.aspx

And second,

Application.OnTime EarliestTime:=dateserial(2009,5,9)+timeserial(9,0,0), _
Procedure:=...., Schedule:=True

Remember that if you close excel, then this scheduled macro won't run.


Elton Law wrote:
>
> Dear Expert,
> Have asked for time marco before.
> Just wonder how to write the date marco in VB please ?
> Say want to run on 5 May 9:00 AM please ?
> Thanks


--

Dave Peterson
 
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
Marco based on date? AccessNoob Microsoft Access 2 6th Oct 2005 10:58 PM
how to use marco rnparikh Microsoft Excel Discussion 10 30th Jul 2005 05:20 PM
Filling a cell with today's date (Datestamp completed marco) =?Utf-8?B?RGlhbmUgQWxzaW5n?= Microsoft Excel Programming 7 14th Feb 2005 10:54 AM
Is there any Excel marco can get key input while the marco is running? SARA Microsoft Excel Programming 7 9th Mar 2004 05:27 AM
marco David Kuehl Microsoft Excel Programming 4 18th Sep 2003 11:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:21 PM.