Import/Export slides by Slide Title?

G

Guest

I would like to export each slide in a presentation to a stand-alone
presentation file. For example, a 20 slide presentation would become 20 ppt
files. I want the names of the standalone files to be the Titles of the
slides in the original presentation.

Then, I would like to be able to import into a new presentation a set of
such stand-alone slides.

The VBA code to export is available from
http://skp.mvps.org/ppt00036.htm#2
but I don't know the property/variable name for "Title" in powerpoint files?
thx
Jonathan
 
G

Guest

Change the corresponding line in Shyam's code to :
sFilename = (sSlideOutputFolder) & oSld.Shapes.Title.TextFrame _
..TextRange & ".ppt"

Note this will error if the slide has no title so you might want to add some
error code or at least make sure that all slides have a title placeholder
--
Amazing PPT Hints, Tips and Tutorials

http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
 
G

Guest

Excellent! Thanks!
This is probably a dumb further question, but it turns out I had hard
returns (CR's) and "?" in some titles, which crashes the macro. Is there a
way to qualify or automatically substitute something like a "_" for illegal
chars in file names?
Jonathan
 
S

Steve Rindsberg

Excellent! Thanks!
This is probably a dumb further question, but it turns out I had hard
returns (CR's) and "?" in some titles, which crashes the macro. Is there a
way to qualify or automatically substitute something like a "_" for illegal
chars in file names?

' Get the title text in a variable:
Dim sTemp as String
On Error Resume Next ' in case no title
sTemp = oSld.Shapes.Title.TextFrame.TextRange.Text
If Len(sTemp) = 0 Then
' No slide title; invent your own like "Slide 42"
sTemp = "Slide " & CStr(oSld.SlideIndex)
Else
' test for bad characters:
sTemp = Replace(sTemp, vbCr, "_")
sTemp = Replace(sTemp, vbLf, "_")
' and so on ... Replace(sTemp, character to find, character to replace it with)
End If

' And finally, this mod to John's code:
sFilename = (sSlideOutputFolder) & sTemp & ".PPT"
 
J

Jonathan

THANKS!
Getting there, BUT:
sTemp = Replace(sTemp, "?", "_")
works to find and replace ? in Titles (illegal as part of filename, but
neither
sTemp = Replace(sTemp, "vbCrLf", "_")
nor any combo of
sTemp = Replace(sTemp, "vbNewLine", "_")
sTemp = Replace(sTemp, vbCrLf, "_")
sTemp = Replace(sTemp, "vbLf", "_")
sTemp = Replace(sTemp, "vbCr", "_")
i.e. w or w/o quotes seems to find and replace hard returns in Titles.
What am I doing wrong?
Jonathan
 
S

Steve Rindsberg

Titles are weird, for some reason. They use Chr$(11) for hard breaks, so try:

sTemp = Replace(sTemp, Chr$(11), "_")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top