Running a macro in VB Script

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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
 
Back
Top