I have some simple Excel VBA code that opens non-Excel files like:
Sub scriptTest()
Set objshell = CreateObject("Wscript.Shell")
objshell.Run ("C:\TestFolder\Book1.pdf")
Set objshell = Nothing
End Sub
Running this opens the file in the Acrobat Reader. However if I try to open a file whose name contains a space character like:
Sub scriptTest()
Set objshell = CreateObject("Wscript.Shell")
objshell.Run ("C:\TestFolder\Bo ok1.pdf")
Set objshell = Nothing
End Sub
I get:
Both files open fine if I use the Run
command from the Windows Start menu. How can I overcome this problem ??