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
> 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
> ================================================