Shell ( ) Function Returning 0

J

Jen

Hi All,

I'm having a problem with the Shell Function. I'm passing
in the .exe file along with a configuration file that the
application uses....works fine the first time. retVal
returns a non zero. Second time around, retVal = 0. I
can't figure out why it's returning a 0. What's even more
strange is that the .exe opens up, yet the retVal = 0.

Sub activateWedge()
Dim x, retVal
Dim cmdLine As String

cmdLine = "C:\WINWEDGE\WINWEDGE.EXE
C:\WINWEDGE\CONFIG_1.SW1"

retVal = Shell(cmdLine)
x = Now + TimeValue("00:00:03")
Do While Now < x
DoEvents
Loop

If retVal = 0 Then
MsgBox "Cannot find winwedge.exe"
Exit Function
Else
AppActivate "Diameter Gauge Application"
End If

chan = DDEInitiate("WinWedge", "Com1")
DDEExecute chan, "[AppExit]" ' specific command that the
' .exe file recognizes
' this code works fine

AppActivate "Diameter Gauge Application"
' I'm only exiting the app for test purposes - until I get
' it so that retVal <> 0

End Sub


TIA for any help on this one.

Regards,
Jen
 

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