Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Macro at certain times

Status
Not open for further replies.

new2ora

Technical User
May 5, 2003
17
CA
Hi,

I want my Macro to start running 6am and stop running at 2pm and then the same for next day. Ideally this happens Monday to Friday.

Thanks

 




Hi,

Well you have two issues.

1. The application file containing the macro must be open prior to that time and

2. you must have an OnTime method configured to run at the specified time. Run the OnTime method in the Open event of the application file containing the macro.

The former can be handled in Scheduled Tasks (in the Control Panel) and check VB help on the latter.

Skip,

[glasses] When a wee mystic is on the loose..
It's a Small Medium at Large! [tongue]
 
Let's back up.

What does this macro do? If you plan on having the macro loop nonstop for this entire period, that will probably eat up the resources of your machine quite a bit. If it is updating a workbook, that workbook will also probably run very slowly.

If you tell us your goal, we might be able to make suggestions that will work better.

In the mean time, here's some info on using Application.OnTime.


[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Thanks guys. The macro in excel when running has a DDE conenction to PLC and reads and records a value every 5 seconds. I will have Excel running on a desktop 24/7.

Thanks
 
could you not use an if statement that says if the current time is between 6 and 2 then to record value. An if statement could also be used for the days as well

ck1999
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top