Link to home
Start Free TrialLog in
Avatar of georgedschneider
georgedschneiderFlag for United States of America

asked on

vbscript to run powerpoint presentation

I using the two script to try ro launch a powerpoint presentation using vbscript.  The first sript runs fine on machine with powerpoint installed.  The second script I thought should run on a machine with just powerpoint viewer installed.  This dies not appear to be the case.  When I attempt to run it I receive the system cannot find the file specified.  The second script is being executed on a x64 Windows 7 professional workstation.
'script 1
Dim objshell
Set objShell = CreateObject("Wscript.Shell")
wscript.sleep 60000
objShell.Run "powerpnt /s  C:\Presentation\3-05-10.ppt"  



'script 2
Dim objshell
Set objShell = CreateObject("Wscript.Shell")
wscript.sleep 60000
objShell.Run "pptview C\:Presentation\3-05-10.ppt"

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of merowinger
merowinger
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of georgedschneider

ASKER

If I run just "C:\Presentation\3-05-10.ppt" from the command line it launches.  Still can't get it to run throught the script.  It states no applications is assoicated with the file for this operation.
what happens if you run this in the commandline:
pptview C\:Presentation\3-05-10.ppt

You can also just start the ppt file without defining the program, so the program which is applied to the ppt file extension will be used.
objShell.Run "C\:Presentation\3-05-10.ppt",1,false
If I subsititute objshell.exec instead of run with the below code it runs without an issue.  Once question though how do I handle if the folder name and file name have spaces such as Lobby Presentation.  For the time being I just changed Lobby Presentation to one word.  
Set objShell = CreateObject("Wscript.Shell")
wscript.sleep 60000
objShell.exec "C:\Program Files (x86)\Microsoft Office\Office12\pptview C:\LobbyPresentation\LobbyPresentation.ppt"

Open in new window

if you have spaces use the followig code:

objShell.exec chr(34) &"C:\Program Files (x86)\Microsoft Office\Office12\pptview C:\LobbyPresentation\LobbyPresentation.ppt" &chr(34)