Date Marco

  • Thread starter Thread starter Elton Law
  • Start date Start date
E

Elton Law

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top