I'm using ShellAndWait from here http://www.cpearson.com/excel/ShellAndWait.aspx and I keep getting 1 returned (which means the command didn't work in Windows). But when i paste my cmdLine into Start, Run box it runs fine. Any ideas? I'm using Excel VBA for this and here's my code that I'm calling ShellAndWait with What am I doing wrong?
thank you very much
Sub test()
Dim cmdLine As String
cmdLine = "C:\Documents and Settings\natalie.rynda\My Documents\Marta\Calling Files\_SFTP\Minacs.bat"
ShellAndWait cmdLine, 1000, vbHide, PromptUser
If ShellAndWait(cmdLine, 1000, vbHide, PromptUser) = 0 Then
MsgBox "yes!!!!!!"
ElseIf ShellAndWait(cmdLine, 1000, vbHide, PromptUser) = 1 Then
MsgBox "1"
ElseIf ShellAndWait(cmdLine, 1000, vbHide, PromptUser) = 2 Then
MsgBox "2"
ElseIf ShellAndWait(cmdLine, 1000, vbHide, PromptUser) = 3 Then
MsgBox "3"
ElseIf ShellAndWait(cmdLine, 1000, vbHide, PromptUser) = 4 Then
MsgBox "4"
ElseIf ShellAndWait(cmdLine, 1000, vbHide, PromptUser) = 5 Then
MsgBox "5"
ElseIf ShellAndWait(cmdLine, 1000, vbHide, PromptUser) = 6 Then
MsgBox "6"
End If
End Sub