Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Running a .bat file via AppActivate

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Running a .bat file via AppActivate

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AppActivate runtime error 5 when used with shell cmd Raymond Zeitler Excel Programming 2 December 11th 10 03:37 PM
running a batch file Mohan[_2_] Excel Programming 3 April 10th 04 10:48 PM
AppActivate problem when called twice SuperJas Excel Programming 0 March 3rd 04 06:41 AM
AppActivate trouble... David Kay Excel Programming 1 December 11th 03 12:17 AM
appactivate sendkeys not working with accelerator RB Smissaert Excel Programming 4 August 12th 03 08:31 PM


All times are GMT +1. The time now is 10:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"