PDA

View Full Version : Solved: Making New Slide Layout Formats?



Paul_Hossler
05-13-2007, 08:34 AM
PP 2003, XP-SP2

Is there a way to create my own slide layout formats?:dunno

For example, I could --

Take the standard "Title and 2 Col Text" format and create one with 3 Col.

Save it it the "Layout Pane" with the standard ones,

Create a new slide with my formtat or re-apply my format to another slide

Paul

TrippyTom
05-14-2007, 08:51 AM
Hey Paul,

This has been a very common request from users and Microsoft finally took the hint and incorporated some very powerful and useful ways of doing this in Office 2007 with custom master pages, custom layouts, multiple placeholders, etc. Unfortunately, it's not so easy to do in earlier versions.

I had the same question a while ago because our office has to follow certain templates, but the Slide Layout taskpane just wasn't as robust as I wanted it to be. So what I ended up doing was literally laying out various slides how I wanted them to look and writing down the top, left, width and height properties of every single object so I could do it via macros.

This sounds tedious, but it was worth it to me in the end. Here's a sample of a 3-column layout that I did. (note: 3 subs)

Sub ThreeCols()
Dim sObj As Shapes
Dim myHeader As Long
Dim myBody As Long
Dim myBullets As Long
Dim mySlide As Long
myHeader = RGB(255, 0, 0) 'Red
myBody = RGB(0, 0, 0) 'Black
myBullets = RGB(0, 0, 255) 'Blue
mySlide = ActiveWindow.View.Slide.SlideIndex

With ActivePresentation.Slides(mySlide)
Set sObj = ActivePresentation.Slides.Add(mySlide + 1, ppLayoutTwoColumnText).Shapes
'Set the placeholder layout and position it (top, left, width, height)
With sObj.Placeholders(2)
.Top = 65.25
.Left = 39.25
.Width = 190
.Height = 409
End With
With sObj.Placeholders(3)
.Top = 65.25
.Left = 264.875
.Width = 190
.Height = 409
End With
With sObj.Placeholders(2).TextFrame.TextRange
With .ParagraphFormat
.LineRuleWithin = msoTrue
.SpaceWithin = 1
.LineRuleBefore = msoTrue
.SpaceBefore = 0.25
.LineRuleAfter = msoFalse
.SpaceAfter = 0
End With
.Text = "Heading" & vbCr & "Bullet 1" & vbCr & "Bullet 2" & vbCr & "Bullet 3"
.Paragraphs
.ParagraphFormat.Alignment = ppAlignLeft
.Paragraphs(1, 1).Font.Size = 14
.Paragraphs(1, 1).Font.Color = myHeader
.Paragraphs(2, 3).Font.Size = 14
.Paragraphs(2, 3).Font.Color = myBody
'turn off bullet for Header
.Paragraphs(Start:=1, Length:=1).ParagraphFormat.Bullet.Visible = msoFalse
'bullet format for next 3 paragraphs
.Paragraphs(Start:=2, Length:=3).ParagraphFormat.Bullet.Visible = msoTrue
.Paragraphs(2).IndentLevel = 1
.Paragraphs(3).IndentLevel = 2
.Paragraphs(4).IndentLevel = 3
With .Paragraphs(Start:=2, Length:=1).ParagraphFormat.Bullet
.Visible = msoTrue
With .Font
.Name = "Wingdings 2"
.Color.RGB = myBullets
End With
.Character = 151
End With
With .Paragraphs(Start:=3, Length:=1).ParagraphFormat.Bullet
.Visible = msoTrue
With .Font
.Name = "Arial"
.Color.RGB = myBullets
End With
.Character = 8211
End With
With .Paragraphs(Start:=4, Length:=1).ParagraphFormat.Bullet
.Visible = msoTrue
With .Font
.Name = "Wingdings"
.Color.RGB = myBullets
End With
.Character = 167
End With
End With
With sObj.Placeholders(3).TextFrame.TextRange
With .ParagraphFormat
.LineRuleWithin = msoTrue
.SpaceWithin = 1
.LineRuleBefore = msoTrue
.SpaceBefore = 0.25
.LineRuleAfter = msoFalse
.SpaceAfter = 0
End With
.Text = "Heading" & vbCr & "Bullet 1" & vbCr & "Bullet 2" & vbCr & "Bullet 3"
.ParagraphFormat.Alignment = ppAlignLeft
.Paragraphs(1, 1).Font.Size = 14
.Paragraphs(1, 1).Font.Color = myHeader
.Paragraphs(2, 3).Font.Size = 14
.Paragraphs(2, 3).Font.Color = myBody
'turn off bullet for Header
.Paragraphs(Start:=1, Length:=1).ParagraphFormat.Bullet.Visible = msoFalse
'bullet format for next 3 paragraphs
.Paragraphs(Start:=2, Length:=3).ParagraphFormat.Bullet.Visible = msoTrue
.Paragraphs(2).IndentLevel = 1
.Paragraphs(3).IndentLevel = 2
.Paragraphs(4).IndentLevel = 3
With .Paragraphs(Start:=2, Length:=1).ParagraphFormat.Bullet
.Visible = msoTrue
With .Font
.Name = "Wingdings 2"
.Color.RGB = myBullets
End With
.Character = 151
End With
With .Paragraphs(Start:=3, Length:=1).ParagraphFormat.Bullet
.Visible = msoTrue
With .Font
.Name = "Arial"
.Color.RGB = myBullets
End With
.Character = 8211
End With
With .Paragraphs(Start:=4, Length:=1).ParagraphFormat.Bullet
.Visible = msoTrue
With .Font
.Name = "Wingdings"
.Color.RGB = myBullets
End With
.Character = 167
End With
End With
sObj.Placeholders(3).PickUp
'make a 3rd text range
Call DoTextBox(mySlide + 1, 1, 65.25, 489, 190, 409)
'Add lines
Call DoDivider(246.875, 65.25, 246.875, 474.25)
Call DoDivider(471.875, 65.25, 471.875, 474.25)
End With
With ActivePresentation.Slides(mySlide + 1)
SendKeys "{PGDN}"
End With
End Sub
Sub DoTextBox(i As Long, Nm As String, tp As Single, lft As Single, wdth As Single, ht As Single)
Dim myHeader As Long
Dim myBody As Long
Dim myBullets As Long
Dim mySlide As Long
myHeader = RGB(255, 0, 0) 'Red
myBody = RGB(0, 0, 0) 'Black
myBullets = RGB(0, 0, 255) 'Blue
mySlide = ActiveWindow.View.Slide.SlideIndex
With ActivePresentation.Slides(i).Shapes.AddLabel(msoTextOrientationHorizontal, Top:=tp, Left:=lft, Width:=wdth, Height:=ht)
.Name = Nm & CStr(i)
'apply same bullet formatting as shape 3 (2nd placeholder)
.Apply
With .TextFrame.TextRange.ParagraphFormat
.LineRuleWithin = msoTrue
.SpaceWithin = 1
.LineRuleBefore = msoTrue
.SpaceBefore = 0.5
.LineRuleAfter = msoTrue
.SpaceAfter = 0
End With
With .TextFrame.TextRange
.ParagraphFormat.LineRuleBefore = msoTrue
.ParagraphFormat.SpaceBefore = 0.25
.Text = "Heading" & vbCr & "Bullet 1" & vbCr & "Bullet 2" & vbCr & "Bullet 3"
.Paragraphs
.ParagraphFormat.Alignment = ppAlignLeft
.Paragraphs(1, 1).Font.Size = 14
.Paragraphs(1, 1).Font.Color = myHeader
.Paragraphs(2, 3).Font.Size = 14
.Paragraphs(2, 3).Font.Color = myBody
'turn off bullet for Header
.Paragraphs(Start:=1, Length:=1).ParagraphFormat.Bullet.Visible = msoFalse
'bullet format for next 3 paragraphs
.Paragraphs(Start:=2, Length:=3).ParagraphFormat.Bullet.Visible = msoTrue
.Paragraphs(2).IndentLevel = 1
.Paragraphs(3).IndentLevel = 2
.Paragraphs(4).IndentLevel = 3
With .Paragraphs(Start:=2, Length:=1).ParagraphFormat.Bullet
.Visible = msoTrue
With .Font
.Name = "Wingdings 2"
.Color.RGB = myBullets
End With
.Character = 151
End With
With .Paragraphs(Start:=3, Length:=1).ParagraphFormat.Bullet
.Visible = msoTrue
With .Font
.Name = "Arial"
.Color.RGB = myBullets
End With
.Character = 8211
End With
With .Paragraphs(Start:=4, Length:=1).ParagraphFormat.Bullet
.Visible = msoTrue
With .Font
.Name = "Wingdings"
.Color.RGB = myBullets
End With
.Character = 167
.RelativeSize = 0.9
End With
End With
End With
End Sub
Sub DoDivider(xBeg As Single, xEnd As Single, yBeg As Single, yEnd As Single)
Dim myColor As Long
Dim mySlide As Long
mySlide = ActiveWindow.View.Slide.SlideIndex
myColor = RGB(0, 0, 255) 'Blue
'add a line (top, left, width, height)
With ActivePresentation.Slides(mySlide + 1).Shapes.AddLine(xBeg, xEnd, yBeg, yEnd).Line
.ForeColor.RGB = myColor
.Weight = 1
End With
End Sub

Paul_Hossler
05-14-2007, 05:03 PM
Thanks -- I thought my office as picky

I was hopeing that the was a way to drag one onto the side bar, or something. Don't know when we'll go to 2007, or when I'll have the $$ to
put it on the home machine.

I'll use your technique, but won't be as extensive as you option formats

Paul