Can anyone help? (please)
I have a PowerPoint 2007 template with a number of custom slides (e.g. "Divider - Blue", "Divider - Green" etc). I would like to programmatically insert one of the slides into a newly created presentation. I have:
prePresentation.Slides.AddSlide(1, pCustomLayout:="Divider - Blue")
which obviously doesn't work !! With AddSlide, it asks for an integar (which I am presuming is the slide position) then CustomLayout. I'm not sure whether I need to cycle the slides and find the one I want and use the index number. I can't seem to find anything on the web to help.
Thanks
Jack21
Inserting Custom Slide from Master - PowerPoint
-
- 2StarLounger
- Posts: 107
- Joined: 23 Mar 2010, 13:42
-
- Administrator
- Posts: 79370
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Inserting Custom Slide from Master - PowerPoint
You'll have to loop through the custom layouts until you find the right one, e.g.
Code: Select all
Dim cl As CustomLayout
For Each cl In prePresentation.Designs("Master").SlideMaster.CustomLayouts
If cl.Name = "Divider - Blue" Then
prePresentation.Slides.AddSlide Index:=1, pCustomLayout:=cl
Exit For
End If
Next cl
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 107
- Joined: 23 Mar 2010, 13:42
Re: Inserting Custom Slide from Master - PowerPoint
Thanks Hans ..... works like a charm.