georgedschneider
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"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
what happens if you run this in the commandline:
pptview C\:Presentation\3-05-10.pp t
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.p pt",1,fals e
pptview C\:Presentation\3-05-10.pp
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.p
ASKER
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"
if you have spaces use the followig code:
objShell.exec chr(34) &"C:\Program Files (x86)\Microsoft Office\Office12\pptview C:\LobbyPresentation\Lobby Presentati on.ppt" &chr(34)
objShell.exec chr(34) &"C:\Program Files (x86)\Microsoft Office\Office12\pptview C:\LobbyPresentation\Lobby
ASKER