Powerpoint

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to export my presentation to jpegs. I would like the Title of
each slide to be the Title of the jpeg, but I'm not sure where to start.

Any help will be much appreciated
 
Martin Ritchie said:
I am trying to export my presentation to jpegs. I would like the Title of
each slide to be the Title of the jpeg, but I'm not sure where to start.

Any help will be much appreciated

There's VBA code here that you can combine to get what you're after.
One of the pages explains how to export slides as graphics, one explains how to
export slide titles as text (and from that you can work out how to get the
slide title to use in naming the file)

Exporting stuff
http://www.pptfaq.com/index.html#name_Exporting_stuff

Bear in mind that you might overwrite files if you have several slides with the
same title.

Also you'll have to be careful not to use characters in the titles that aren't
permissible in filenames.
 
Thanks very much for you help. I was able to combine the bits from both
examples to create the jpegs from each slide. The jpegs are saved in a folder
with the same name as the presentation, and as long as this folder exists,
then the jpgs are created correctly.


Sub GatherTitles()

On Error GoTo ErrorHandler

Dim oSlide As Slide
Dim strTitles As String
Dim strFilename As String
Dim PathSep As String

PathSep = "\"
strFilename = ActivePresentation.Path _
& PathSep _
& Mid$(ActivePresentation.Name, 1, Len(ActivePresentation.Name) - 4) _
& PathSep

On Error Resume Next ' in case there's no title placeholder on the slide
For Each oSlide In ActiveWindow.Presentation.Slides
strTitles = oSlide.Shapes.Title.TextFrame.TextRange.Text _
& ".jpg"
With oSlide
.Export strFilename & strTitles, "JPG"
End With
Next oSlide
On Error GoTo ErrorHandler

NormalExit:
Exit Sub

ErrorHandler:
MsgBox Err.Description
Resume NormalExit

End Sub
 
Nicely done!

Martin Ritchie said:
Thanks very much for you help. I was able to combine the bits from both
examples to create the jpegs from each slide. The jpegs are saved in a folder
with the same name as the presentation, and as long as this folder exists,
then the jpgs are created correctly.

Sub GatherTitles()

On Error GoTo ErrorHandler

Dim oSlide As Slide
Dim strTitles As String
Dim strFilename As String
Dim PathSep As String

PathSep = "\"
strFilename = ActivePresentation.Path _
& PathSep _
& Mid$(ActivePresentation.Name, 1, Len(ActivePresentation.Name) - 4) _
& PathSep

On Error Resume Next ' in case there's no title placeholder on the slide
For Each oSlide In ActiveWindow.Presentation.Slides
strTitles = oSlide.Shapes.Title.TextFrame.TextRange.Text _
& ".jpg"
With oSlide
.Export strFilename & strTitles, "JPG"
End With
Next oSlide
On Error GoTo ErrorHandler

NormalExit:
Exit Sub

ErrorHandler:
MsgBox Err.Description
Resume NormalExit

End Sub
 
Back
Top