All with the following I can get my .exe file opened up except when there are spaces in the name.
Please note the following below:
Because the program PDF Parser.exe has a space it never seems to find the file to open and run it.
How do I change the syntax below to make this work?
I have tried several samples shown here:
Is there another I can try?
Does someone have an .exe file to try and open - perhaps rename it with a space and try the following code below:
sExecutable = "C:\Users\slecompte\Documents\SMW_Transfer\PDF Parser\PDF Parser.exe"
Set objShell = WScript.CreateObject( "WScript.Shell" )
If LikeFunction(sExecutable) = False Then
'this line works when a file has no spaces.
objShell.Run "%comspec% /c start " & sExecutable, 0, True
'this line doesn't work no matter what I try:
Set objShell = WScript.CreateObject("WScript.Shell")
strCommand = "%comspec% /c start "& chr(34) & sExecutable & chr(34)
'sExecutable = chr(34) & chr(34) & chr(34) & sExecutable & chr(34) & chr(34) & chr(34)
objShell.Run strCommand , 1, True
Set objShell = Nothing
Public Function LikeFunction(sValue)
For i = 1 to len(sValue)
If mid(sValue, i, 1) = " " Then
bValue = True
LikeFunction = bValue