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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a macro from batch

Status
Not open for further replies.

gertNo1

Technical User
Sep 30, 2007
42
Hi Guys, I'm trying to call a macro from a *.bat file but not having a lot of success. I know that I can run it from the scheduler but I really need it to run from batch. Any suggestions?

When I ran
“C:\Program Files\Microsoft Office\OFFICE11\ MSACCESS.EXE" “X:\GEL\Sysmat.mdb” /x mcr_Start_Sales_Type_Processing
The system opened MSACCESS and hung, when I closed Access the program opened but didn’t execute the macro

When I ran
“X:\GEL\Sysmat.mdb” /x mcr_Start_Sales_Type_Processing
The program opened but didn’t execute the macro

Thanx,
Trudye
 
What about this

"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "X:\GEL\Sysmat.mdb" /x "mcr_Start_Sales_Type_Processing"

There was an extra space before MSACCESS.EXE and no quotes surrounding the macro name mcr_Start_Sales_Type_Processing
 
Thanx Guys for responding so quickly.

Sorry about that JerryKlmns that was a typo on my part. When I checked my batch file no space existed.

I tried putting the Quotes around the macro name. But I'm still getting the same thing. Whenever I include the path to MSACCESS it opens a blank Access screen and just sits there. When I close Access it initiates the next command which calls Sysmat.mdb and again it just sits there.

The batch file was defaulting to the D:\> drive so it changed it to point to C:\>, and included the new path to MSACCESS.EXE. And still no go.

I re-pasted the macro name to insure that I had not mispelled it. I dbl clicked on the macro to insure that it worked. Just trying to cover the stupid stuff because that usually what gets ya.

I'm stuck, any other suggestions?
 
You've checked the logical things then. I'd try replacing the X: with the UNC version of whatever the server/share path is, i.e.

"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "\\YourServerName\YourShareName\GEL\Sysmat.mdb" /x "mcr_Start_Sales_Type_Processing"

I'd try this in case there is some kind of referencing issue.

Does an Access scheduling tool like the Handy Access Launcher fire up your macro correctly?
 
Thanx mp9 for responding. I'm a contractor and do not have Admin rights to download software. So Handy Access launcher is out of the question.

However, I will try your first suggestion and let you know how it works out.

Thanx again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top