Shell Command

rube

Registered User.
Local time
Today, 21:37
Joined
Jun 21, 2003
Messages
76
I have a Code that pulls the Executable for an External Program. When I try to run the program, it runs just fine, but does not pull the actual file, though I know the path is correct. (i.e. P:\Image\Compaq Presario 1200.jpg".

If I append the filename, "P:\Image\Compaq~1.jpg", it works fine. What allows me to use more than 8 characters/spaces in for one, but not the other?

And do I have to append this and is there a Function to do so?

I have a book with an example of using the Shell, but his example will not pull the file either unless I edit the filename.


Thanks for any input.

Rube
 
rube,

The embedded spaces are the problem ...

You have to enclose the whole filespec in double-quotes.

Do a search here on shell for similar examples.

Wayne
 
Chr(34)

Wayne,
Once again, right on the money, I tried adding the quotes like you would for a string variable, without success, same issue. I found where a user used Chr(34), worked like a champ.

If lngReturnVal > 32 Then 'Checks for a Valid Association.
varExecutable = Left(EXEPath, InStr(1, EXEPath, Chr(0)) - 1)
lngReturnVal = Shell(varExecutable & " " & Chr(34) &
Me.Currentpath & Chr(34))
Else
MsgBox "No Associated Program to Open File", vbOKOnly +
vbCritical, "No Program"
End If

I would like to express my sincere appreciation for you taking the time to answer these many questions. You are a credit to this website.

Thanks...

Rube.
 

Users who are viewing this thread

Back
Top Bottom