run macro outside excel

frank_taos

New Member
Joined
Apr 20, 2010
Messages
10
Hello:
I have a macro inside an excel 2007 workbook. I would like to know how I can run this macro from outside excel in a silent mode. I need to run the script (batch or vba) on an scheduler to clean a file that will be imported into access. Thanks in advance for your help.
Frank.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Welcome to the Board!

Why not have Windows Scheduler open it then call your code in the Workbook_Open event.

HTH,
 
Upvote 0
Thank you Smitty.
I am learning while I am solving it. I managed to put my code inside Private Sub Workbook_Open() and so I can test it while inside my vba environment and also every time I open my workbook. Now, if I want to save the Private Sub Workbook_Open() as a code module (i.e .exe) so I can call it from the scheduler, how should I do it? Sorry for such basic questions! Thanks a lot.
Frank.
 
Upvote 0
No worries.

You can't really compile VBA code, you'd need .NET for that. But if the code's in the Open event then when scheduler opens the wb the code's gonna' fire anyway, so it should do what you need.
 
Upvote 0
Smitty: I need to schedule a similar task to import data in my Access DB. I created a macro using RunSavedImportExport, and I can run it inside Access 2007 and do the job. Now if I want this to run scheduled as in the Excel previous example, what would be the logic. Not sure if this is the place to ask. Thanks.
Frank
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,636
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top