Nick
--
Regards,
Tom Ogilvy
Sub belfry()
x = Shell("cmd.exe /c C:\x.bat", 1)
End Sub
CMD "understands" what to do with .bat files
--
Gary's Student
Sub EFG()
Shell "C:\Data2\mybat.bat"
End Sub
--
Regards,
Tom Ogilvy
Note By default, the Shell function runs other programs
asynchronously. This means that a program started with Shell might not
finish executing before the statements following the Shell function are
executed.
Do you think it's possible that I am not getting my results because the
MS-DOS command prompt window is being closed before it's finished
executing the batch file?
Thanks.
Once the shell command is executed, the vba code continues on. The bat file
is running in another thread disconnected from the vba code. What are you
trying to accomplish and how are you trying to use the results of the bat
file.
--
Regards,
Tom Ogilvy
Maybe, you can add commands to go to that drive and folder to the top of the
.bat file:
@echo off
c:
cd C:\yourfolderhere
...
=====
Or maybe the .bat file isn't finishing quickly enough. You could use a method
to wait for the .bat file to finish--or you could just estimate how long it
takes and pause your macro a bit.
'shell to the .bat file
application.wait now+timeserial(0,0,10)
'(for 10 seconds)
--
Dave Peterson