Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Schedule a Macro to Run

Schedule a Macro to Run

Schedule a Macro to Run

How do you setup a macro to run at a certain time everyday without being manually started?


RE: Schedule a Macro to Run

Hi JulieS!

I think you won't get this done without some programming work. I guess you can do this with VBA.
Try it with an endless-loop which does time-checking the whole time. If the time equals your starting-time you can perform the macro by calling it. But therefore your office application has to be open the whole day till the macro ran!

I don't know if this is what you want?!




RE: Schedule a Macro to Run

   Here is some info on the OnTime Procedure from the Excel vba help. It should make it fairly easy to accomplish what you want. You probably want to add it in the workbook_open event of the workbook with the macro. It is a method of the Application object so 'expression' in this help file would just be Application

Application.OnTime TimeValue("17:00:00"), "MacroName"

would schedule a macro called MacroName to run at 5pm.

Schedules a procedure to be run at a specified time in the future (either at a specific time of day or after a specific amount of time has passed).


expression.OnTime(EarliestTime, Procedure, LatestTime, Schedule)

expression   Required. An expression that returns an Application object.

EarliestTime   Required Variant. The time when you want this procedure to be run.

Procedure   Required String. The name of the procedure to be run.

LatestTime   Optional Variant. The latest time at which the procedure can be run. For example, if LatestTime is set to EarliestTime + 30 and Microsoft Excel is not in Ready, Copy, Cut, or Find mode at EarliestTime because another procedure is running, Microsoft Excel will wait 30 seconds for the first procedure to complete. If Microsoft Excel is not in Ready mode within 30 seconds, the procedure won't be run. If this argument is omitted, Microsoft Excel will wait until the procedure can be run.

Schedule   Optional Variant. True to schedule a new OnTime procedure. False to clear a previously set procedure. The default value is True.


Use Now + TimeValue(time) to schedule something to be run when a specific amount of time (counting from now) has elapsed. Use TimeValue(time) to schedule something to be run a specific time.

Experienced with:

VB6, SQL Server, QBASIC, C(unix), MS Office VBA solutions

ALSO: Machine Control/Automation using GE and Omron PLC's and HMI(human machine interface) for industrial applications

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close