Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / January 2007

Tip: Looking for answers? Try searching our database.

How to export PPT images with slide names instead of numbers?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bon4ire - 07 Jan 2007 08:20 GMT
I'm trying to create a bunch of images from a sequence of slides in
PPT.  I know I can save as JPGs for all slides, but it saves it under
one folder as a sequence. What I want to do save with the title name of
the slide.

Each slide has a name like Cat, Dog, Tiger, etc. and want it to save as
Cat.jpg, Dog.jpg, Tiger.jpg etc.

How does one go about doing this?  I searched all over the net but
found nothing.  The only thing is saw was to save each individual slide
by itself from which the filename will inherit the the slide name.  But
it's too tedious epecially with a bunch of animal names.

Thanks
Chirag - 07 Jan 2007 09:59 GMT
The following macro will save the slides as JPGs in your home folder
(usually, "C:\Documents and Settings\<username>\"). It uses the slide titles
for the file names.

---
Sub ExportSlidesWithTitlesAsFileNames()
   Dim Pres As Presentation
   Dim Sld As Slide
   Dim FilePath As String
   Dim FileName As String

   Set Pres = ActivePresentation
   FilePath = Environ("HOMEDRIVE") + Environ("HOMEPATH") + "\"
   For Each Sld In Pres.Slides
       FileName = ""
       If Sld.Shapes.HasTitle Then
           If Sld.Shapes.Title.HasTextFrame Then
               If Sld.Shapes.Title.TextFrame.HasText Then
                   FileName = Sld.Shapes.Title.TextFrame.TextRange.Text
               End If
           End If
       End If
       If FileName = "" Then
           FileName = Sld.Name
       End If
       FileName = FileName + ".jpg"
       Sld.Export FilePath + FileName, "jpg"
   Next
End Sub
---

- Chirag

 PowerShow - View multiple PowerPoint slide shows simultaneously
 http://officeone.mvps.org/powershow/powershow.html

> I'm trying to create a bunch of images from a sequence of slides in
> PPT.  I know I can save as JPGs for all slides, but it saves it under
[quoted text clipped - 10 lines]
>
> Thanks
Steve Rindsberg - 07 Jan 2007 18:27 GMT
> The following macro will save the slides as JPGs in your home folder
> (usually, "C:\Documents and Settings\<username>\"). It uses the slide titles
> for the file names.

And modified like so, will ignore the titles and use just the slide name:

Sub ExportSlidesWithTitlesAsFileNames()
    Dim Pres As Presentation
    Dim Sld As Slide
    Dim FilePath As String
    Dim FileName As String

    ' Add error handler in case slide name contains
    ' characters not allowable in file names
    On Error Resume Next

    Set Pres = ActivePresentation
    FilePath = Environ("HOMEDRIVE") + Environ("HOMEPATH") + "\"
    For Each Sld In Pres.Slides
        FileName = ""

    '    If Sld.Shapes.HasTitle Then
    '        If Sld.Shapes.Title.HasTextFrame Then
    '            If Sld.Shapes.Title.TextFrame.HasText Then
    '                FileName = Sld.Shapes.Title.TextFrame.TextRange.Text
    '            End If
    '        End If
    '    End If

        If FileName = "" Then
            FileName = Sld.Name
        End If
        FileName = FileName + ".jpg"
        Sld.Export FilePath + FileName, "jpg"
    Next
End Sub

> - Chirag
>
[quoted text clipped - 15 lines]
> >
> > Thanks

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Bon4ire - 07 Jan 2007 23:47 GMT
Thanks Chirag and Steve for replying so quickly! Worked like a charm!
I did run across one problem, and that was when I had an animal name
with a question mark.  The macro errors on a '?' but not on a '!'.  How
would I modify the macro to subtract a question mark from the name
string?

Again thanks!

> > The following macro will save the slides as JPGs in your home folder
> > (usually, "C:\Documents and Settings\<username>\"). It uses the slide titles
[quoted text clipped - 58 lines]
> PPTools:  www.pptools.com
> ================================================
Bon4ire - 07 Jan 2007 23:55 GMT
I meant to ask how to export the file without the question mark in the
filename while retaining the question mark in the exported jpg image.

Thanks
Steve Rindsberg - 08 Jan 2007 04:44 GMT
> Thanks Chirag and Steve for replying so quickly! Worked like a charm!
> I did run across one problem, and that was when I had an animal name
> with a question mark.  The macro errors on a '?' but not on a '!'.  How
> would I modify the macro to subtract a question mark from the name
> string?

One more round of mods below ...  Enjoy!

Sub ExportSlidesWithTitlesAsFileNames()
   Dim Pres As Presentation
   Dim Sld As Slide
   Dim FilePath As String
   Dim FileName As String

   ' Add error handler in case slide name contains
   ' characters not allowable in file names
   On Error Resume Next

   Set Pres = ActivePresentation
   FilePath = Environ("HOMEDRIVE") + Environ("HOMEPATH") + "\"
   For Each Sld In Pres.Slides
       FileName = ""

   '    If Sld.Shapes.HasTitle Then
   '        If Sld.Shapes.Title.HasTextFrame Then
   '            If Sld.Shapes.Title.TextFrame.HasText Then
   '                FileName = Sld.Shapes.Title.TextFrame.TextRange.Text
   '            End If
   '        End If
   '    End If

       If FileName = "" Then
           FileName = Sld.Name
       End If

  ' now eliminate illegal characters
  FileName = Replace(FileName, "?", "_")
  FileName = Replace(FileName, "*", "_")
  FileName = Replace(FileName, ",", "_")
  ' repeat for any other characters that prove troublesome
       
       FileName = FileName + ".jpg"
       Sld.Export FilePath + FileName, "jpg"
   Next
End Sub

> > > - Chirag
> > >
[quoted text clipped - 92 lines]
> > PPTools:  www.pptools.com
> > ================================================

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Bon4ire - 08 Jan 2007 05:15 GMT
Super thanks!

> > Thanks Chirag and Steve for replying so quickly! Worked like a charm!
> > I did run across one problem, and that was when I had an animal name
[quoted text clipped - 144 lines]
> PPTools:  www.pptools.com
> ================================================
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.