|
OfficeTips Home || VBA Section || General Section || Download Section || Privacy Policy |
Scripting Example to Export a PowerPoint Presentation as JPEGs |
|
|
This example illustrates the use of Windows Scripting Host to automate the process of creating JPEGs of the slides in a PowerPoint presentation. You will need to copy the code below into a notepad file and ensure that you save it with a .VBS extension. ' -------------------------------------------------------------------------------- MessageText = "Script to open a PowerPoint Presentation and Export as JPEGs." TitleText = "PowerPoint Scripting Example" Call Welcome()
Dim oPPT
Dim oPPTDoc
Dim sPath
Dim sOutput
sPath= InputBox("Enter the path to the file:",TitleText )
sOutput= InputBox("Enter the path to export JPEGs to:",TitleText )
Set oPPT = WScript.CreateObject("PowerPoint.Application")
' You can comment the line below to keep PowerPoint hidden.
oPPT.Visible = TRUE
Set oPPTDoc=oPPT.Presentations.Open(sPath,,,False)
oPPTDoc.Export sOutput,"JPG"
oPPTDoc.Close
Set oPPTDoc = Nothing
oPPT.Quit
set oPPT = Nothing
MsgBox "Export complete.",vbInformation+vbOkOnly,TitleText
Sub Welcome()
Dim iPrompt
iPrompt = MsgBox(MessageText, _
vbOKCancel + vbInformation, _
TitleText )
If iPrompt = vbCancel Then
WScript.Quit
End If
End Sub
|
|
Copyright 1999-2014 (c) Shyam Pillai. All rights reserved.