Running a .bat file via AppActivate

K

Kevin

I'm trying to run a .bat file from a macro. I can call
an .exe with no problem (using the same "shell" and
AppActivate" code). I can even call a .exe renamed as
a .bat. If I run it from a command line directly, or even
by double clicking on it, it runs fine. However I cannot
run the .bat from the shell/appactivate combo. Here's the
code I'm using:

varPuttyUpload = Shell("c:\opt_mist1
\ssh\mist1_mist1upload.bat", 0)
AppActivate varPuttyUpload

Watching the locals windows stepping through the macro
shows a return value from the shell function of -610925
(which seems odd).

Changing the trigger from 0 to 1 has no effect. No matter
what I do, I get the following:

"Run-time error '5':
Invalide procedure call or arguement."

If I substitute say "calc.exe" it runs fine.

Any suggestions?

thanx

Kevin
 
R

Rob van Gelder

Is that a space after the word opt_mist or just a result of e-mail word
wrapping?

Could try to wrap quotes around it:
varPuttyUpload = Shell("""c:\opt_mist1 \ssh\mist1_mist1upload.bat""", 0)

Another thing is the , 0 in the Shell statement which tells it to Hide the
window (vbHide = 0)
You could try to use normalfocus (1) for testing purposes:
Shell("mycommand", vbNormalFocus)
 

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