Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch File Executing Macro-Problem

Status
Not open for further replies.

Blake290

MIS
Apr 3, 2003
17
US
I've written a macro to export information to a spreadsheet and then to quit Access. I've also written a batch file to execute a shortcut to launch the macro. The batch file is as follows: d:\datar\studt\storoh.mam

The actions in the Marco are:
Output to and Quit

The batch file launches the macro fine and the macro closes the Acess window fine, but at that point an error message pops up on screen:

Cannot find the file 'd:\datar\studt\storoh.man' (or one of its components), Make sure the path and filename are correct qand that all required libraries are available

It is as if the batch file did not expect the macro to close the application. Is there a switch or command that I need to put in the batch file or in the macro to have the macro close and the batch file quit gracefully?
 
I might be off track here, but have you tried another method? Rather than using the macro as a shortcut itself, use the command line in a batch file to execute the macro. I use this when the database itself is not running (hence the MSAccess.exe reference).

Example batch is below: (I've used default location for Access 2002 exe file) I use these for several automated tasks. You can start the batch by any sort of scheduler as well...

"C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE" "C:YourDatabaseLocation.mdb"/x
YourMacroName /wrkgrp YourWorkgroupIfyouHaveOne.mdw
Exit

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top