Automatically run an Excel macro

S

sxhwabbiemike

I have an Excel macro theat I would like to automatically run using Windows
XP Scheduled Tasks.

Is this possible...if I could invoke the macro via a BAT or CMD file that
would be great.
 
B

bpeltzer

Put your code in a subroutine named Auto_Open, then use the task scheduler to
open your Excel file. Be sure your macro security is such that your macro
can run without any prompts.
 
S

sxhwabbiemike

I did that, however whenever I try t view the file that was created by the
macro it reruns the macro.

I woould like to save the file to a common site (iKnow) for viewing by
others without it being recreated each time someone wants to view it.
 
B

bapeltzer

There are several ways you could allow the macro to start automatically (via
the Auto_Open) and conditionally exit before it runs... For your purposes,
it sounds like you might just check the path (activeworkbook.path) and exit
if it's not your local copy. Also, FYI, if the file is found via File >
Open, then shift-click will open the file without executing the macro (vs
clicking on Open which will open and execute).
 

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

Top