Cannot open PPT with whitespace in path name.

G

Guest

I am into PowerPoint Automation.

I am facing a peculiar problem. I have a PPT, PPTViewer 2003, AutoRun.lst &
my Application. I have all these 4 files stored in one folder. My Spplication
checks the location of the AutoRun.lst & the PPTVIewer.exe. Then it runs the
a command on shell/run as:
<path of pptviewer> /L <path of .lst file>

This makes the PPTViewer read the correspoding .lst file and run the ppt
name that is written in it.

Now, the problem is if the path of viewer or the path of .lst file contains
whitespace then it will not run the command. For eg. If I save all these
files on the desktop then the path wil be something like "C:\Documents and
Settings\Admin\Desktop\PPTViewer.exe". So here there are two whitespaces in
the PPTViewer path name. When I run this command on the run (shell) then I
get an error saying "Windows cannot find the file C:\Documents". It will just
take the path before the first whitespace. If I place these files under, say,
c:\ then it will run fine.

Can anyone please tell me how can I make my command run properly even if
there are whitespaces in the path for PPTViewer.exe.

Please help me...this is very urgent.

Thanks a lot in advance.
 
S

Steve Rindsberg

Technoknight said:
I am into PowerPoint Automation.

I am facing a peculiar problem. I have a PPT, PPTViewer 2003, AutoRun.lst &
my Application. I have all these 4 files stored in one folder. My Spplication
checks the location of the AutoRun.lst & the PPTVIewer.exe. Then it runs the
a command on shell/run as:
<path of pptviewer> /L <path of .lst file>

This makes the PPTViewer read the correspoding .lst file and run the ppt
name that is written in it.

Now, the problem is if the path of viewer or the path of .lst file contains
whitespace then it will not run the command. For eg. If I save all these
files on the desktop then the path wil be something like "C:\Documents and
Settings\Admin\Desktop\PPTViewer.exe". So here there are two whitespaces in
the PPTViewer path name. When I run this command on the run (shell) then I
get an error saying "Windows cannot find the file C:\Documents". It will just
take the path before the first whitespace. If I place these files under, say,
c:\ then it will run fine.

Can anyone please tell me how can I make my command run properly even if
there are whitespaces in the path for PPTViewer.exe.

Put the full path to the EXE in quotes. Do the same for the path to the .lst
file.

For example:

Shell(Chr$(34) & sPathToViewer & chr$(34) & " /L " _
& Chr$(34) & sPathToListFile & Chr$(34))
 
G

Guest

Thanks a lot :).

Steve Rindsberg said:
Put the full path to the EXE in quotes. Do the same for the path to the .lst
file.

For example:

Shell(Chr$(34) & sPathToViewer & chr$(34) & " /L " _
& Chr$(34) & sPathToListFile & Chr$(34))


-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
 

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