PDA

View Full Version : Splitting Content Placeholder onto new Slides



Paul_Hossler
04-03-2011, 08:36 AM
Stuck on a macro to split a slide in design mode into a series of new slides, each basically the same, but with the original Level One headings seperated and each on a new slide:think:


http://office.microsoft.com/en-us/powerpoint-help/split-body-text-between-two-slides-HA010177834.aspx

is the manual way to do it, but an automated way would be much easier


If the macro could work on all the slided in a selection, that would be a nice bonus

Sample PP with Before (Slide1) and After (Slides 2, 3, and 4) attached (just rename off the ".zip" part).

Any help appreciated

Paul

John Wilson
04-04-2011, 03:42 AM
Hi Paul

Top of head coding but should set you off!

Sub paul()
Dim osld As Slide
Dim opres As Presentation
Dim otxtR As TextRange
Dim i As Integer
Dim n As Integer
Dim pos() As Integer
Dim icount As Integer

Set opres = ActivePresentation
Set osld = opres.Slides(opres.Slides.Count)
Set otxtR = osld.Shapes(2).TextFrame.TextRange
ReDim pos(1 To 1)
For i = 1 To otxtR.Paragraphs.Count
If otxtR.Paragraphs(i).IndentLevel = 1 Then
n = n + 1
pos(n) = otxtR.Paragraphs(i).Start
ReDim Preserve pos(1 To UBound(pos) + 1)
End If
pos(n + 1) = otxtR.Characters.Count
Next i
For i = 1 To n
opres.Slides(1).Duplicate
Next
For i = 2 To n + 1
Set osld = opres.Slides(i)
Set otxtR = osld.Shapes(2).TextFrame.TextRange
otxtR = Mid(otxtR.Text, pos(i - 1), pos(i) - pos(i - 1))
Next i
End Sub

Paul_Hossler
04-04-2011, 04:42 PM
Thanks

Always nice to learn by single steping through macros and watching the effects.

Would you think I was being fussy if I asked that the Indent Level 2-n be preserved on the Duplicated slides?

Paul