Running a macro in VB Script

S

Shawn

How do I run a Microsoft Access macro in a VB script? I want to write a vb
script that will open and run a database for me and then schedule the script
using Task Scheduler.

Thanks
 
D

Douglas J. Steele

You can specify a macro to run when you open the database. Either name it
AutoExec, or, if you only want it run under certain conditions, name it
something else, and pass it as a parameter when you open the database:

"C:\Program Files\Microsoft Office\Office\MSAccess.exe" "C:\Program
Files\Microsoft Office\Office\Samples\Northwind.mdb" /x MacroName
 
B

bob

a simple technique would be to make the macro run when the database starts
(call it autoexec); then use a batch file or a vbs script to open the
database.

Alternatively put something like this in a batch file:
"C:\Program Files\Microsoft Office\Msaccess.exe" "C:\test\test.mdb" /x
"macro name"

Bob
 

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