Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax for WshShell.Run to open Powerpoint 2007 in Show mode 1

Status
Not open for further replies.

willeyc

Programmer
Sep 18, 2013
3
CA
Hi everyone
The following only opens Powerpoint application and not the document.
WshShell.Run """C:\Program Files\Microsoft Office\Office12\POWERPNT.EXE""" & "/s" & strFileName,1,True
If I take out the & "/s" the document opens but in Edit mode.
 
Hi [peace]
I think you forgot a sapce after /s
Try this :
Code:
'You need to save your presentation as a "Powerpoint Show"
'Open the presentation you want to save as a slide show.
'On the File menu, click Save As.
'In the Save as type list, click PowerPoint Show. Your slide show file will be saved with a .pps file extension.
'When you open this file from your desktop, it will automatically start your presentation in slide show view
Set WshShell = CreateObject("Wscript.Shell")
strFileName = "c:\Document Path\MyDocument.ppsx"
WshShell.Run "POWERPNT.EXE /s" &" "& DblQuote(strFileName),1,false
'**********************************************************************************************
'Function to add double quotes in a variable
Function DblQuote(Str)
	DblQuote = Chr(34) & Str & Chr(34)
End Function
'**********************************************************************************************
 
Hi crackoo
Thanks for your reply. I like your dblequote function.
Anyway I get "The system cannot find the file specified" on line:
WshShell.Run "POWERPNT.EXT /s" &" "& DblQuote (strFileName) ,1,True
 
Hi crackoo
I made a stupid typing mistake .EXT instead of .EXE. It now works great, thankyou
 
Why not simply this ?
WshShell.Run DblQuote(strFileName),1,True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top