how to run shell command in VB?
Posted on 2000-04-17
I want to run shell command from my application. My exe(in my case, winword.exe) is in Program Files Folder
so i tried the following code,
But both of my exe and html files are in Program Files folder which has a empty space in their name.
dim llShellRet as long
dim lsPath as string
lsPath = "C:\Program Files\Microsoft Office\Office\Winword.exe C:\Program Files\Kbs9a\html\satbintro.htm"
llShellRet = Shell(lsPath & "", vbMaximizedFocus)
So actually what happens is Microsoft word is actually open but it's looking for C:\Program.doc and later looking for Files\Kbs9a\html\satbintro.htm file and doesn't open the correct file and opens a new file.
How to avoid this situation.
I can't ask the user not to leave space in their name or not to install the application in Program files folder.
but how to overcome this problem?
Thanks in advance,