starting .bat file from excel VBA

M

Mark

Hi,
I'm using
AppFile = "C:\P_R_O_G\_xls_ZAG\F_FAKT.BAT"
Shell "Start" & AppFile
to start my dos program from VBA macro in Excel and VBA answer is "File not
found".
What am I doing wrong? (path is correct, file exist)
 
D

Dave Peterson

Without testing...

Shell "Start " & AppFile

An extra space after Start.

And if AppFile could ever have spaces embedded:

Shell "Start " & chr(34) & AppFile & chr(34)

Chr(34) is the double quote character, but it's still untested.
 
G

Gary''s Student

Try:

Sub Macro1()
x = Shell("cmd.exe /c C:\P_R_O_G\_xls_ZAG\F_FAKT.BAT", 1)
End Sub
 

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