Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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) -- Rob van Gelder - http://www.vangelder.co.nz/excel "Kevin" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
AppActivate runtime error 5 when used with shell cmd | Excel Programming | |||
running a batch file | Excel Programming | |||
AppActivate problem when called twice | Excel Programming | |||
AppActivate trouble... | Excel Programming | |||
appactivate sendkeys not working with accelerator | Excel Programming |