Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 13th, 2006, 04:59 AM
Registered User
 
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default run a macro at a certain date

how can I run a macro at a specified date or tim ?
for exampel i want to run macro each saturday at 7:00 AM.

 
Old May 13th, 2006, 03:15 PM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am a beginner myself, but maybe this helps you a bit further.

To run a macro at a certain time you can use the following:

application.ontime date + timeserial(7,0,0),"name of your macro"

this will make your macro run at this day on 7 pm.

If you want to run a macro next saterday you can do the following:

startdate=dateserial(2006, 5,20)
application.ontime startdate + timeserial(7,0,0),"name of your macro"

It is not neccesary to keep the sheet open, but excel should be running in the background to keep track of time.

Good luck,

Jeroen



 
Old May 14th, 2006, 01:52 AM
Registered User
 
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i want to run this macro only one time on each saturday . for example if at 7:00 excel wasn't open the macro run at the first time the program be opend , and don't be run until next saturdey .
what should i do now ?

 
Old May 15th, 2006, 03:25 AM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It is impossible to run a macro without opend excel!

I think you may open excel with VB6 and then you can execute your code.

But I can't help you with this problem because I'm not particularly good in VB6.

Ask a question in the VB forum I think someone will help you with your problem



I hope this is good english, because this tongue is not my native language.
Please improve me if my syntax is wrong.
Thanks
 
Old May 17th, 2006, 06:34 AM
Registered User
 
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

where should I write this cod :
'application.ontime date + timeserial(7,0,0),"name of your macro" ' , if i want excel to run my macro at this certain time . i mean if my file wasn't open (but excel was open)how dose excel run this macro for example at 7:00 ?







Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible to run macro from another workbook? rmilward Excel VBA 2 September 26th, 2009 08:00 PM
How do i run Macro on Web [email protected] Excel VBA 2 April 17th, 2008 01:04 AM
Run code in Macro Corey Access VBA 4 February 5th, 2007 10:54 AM
run macro from asp aspuser27 Excel VBA 3 January 28th, 2005 04:30 AM
Macro Doesn't Run? CoryKutchera Excel VBA 3 January 5th, 2005 10:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.