Executing a batch file.

  • Thread starter Thread starter James
  • Start date Start date
J

James

I'm trying to execute a bat file from Access 97 in VBA.
My statement is as follows:

Shell "Z:\GM Wholesale Production Operations
Admin\BAM\SharePoint Archive\Core LFC\LFC Rate
Lock\ZIP_RATE_LOCK.bat"

When I double click on ZIP_RATE_LOCK.bat using Windows
Explorer or pasting it in the Run Command, it executes
fine.
 
The bat file might have been executed fine but the DOS
windows disapppeared as soon as it appeared, especially
since you did not specify the WindowStyle argument for the
Shell.

I tested with the following in A2K2:

* Test.bat simply changes a file name.

* Shell "C:\Documents and Settings\vdinh\test.bat"

works fine but I cannot see anything on screen.

* Shell "C:\Documents and Settings\vdinh\test.bat",
vbNormalFocus

works fine, but the DOS window disappears as soon as it
appears.

* To keep the DOS window on screen, I use:

Shell "cmd.exe /K
""C:\Documents and Settings\vdinh\test.bat""",
vbNormalFocus

(typed as one line).

HTH
Van T. Dinh
MVP (Access)
 

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

Back
Top