VBA 2007-customlayout

  • Thread starter Thread starter Edward
  • Start date Start date
E

Edward

Hi everybody,
In PP2007 I have added a cutomlayout to layout collection. I use the
following code to change the layout of a given slide
ActivePresentation.Slides(1).Layout = ppLayoutText
This code works fine with all built in layouts ,but I can't find a way to
apply the cutom layout . when I use the following code

ActivePresentation.Slides(1).Layout =ppLayoutCustom
I get the error
Slide (unknown number) : Invalid request. Invalid enumeration value.

Any suggestions that how can we apply a cutom layout in VBA?
 
In PowerPoint 2007, a presentation has designs, each design has a
SlideMaster and that slide master has CustomLayouts collection with it. So,
you get access to an individual CustomLayout. Each slide refers to a
CustomLayout and you can assign it with a reference to the CustomLayout you
obtain from the Design.SlideMaster.CustomLayouts collection of the
presentation.

The ~40 Layouts that you are refering to from VBA are the pre-defined
layouts. You can indeed apply those and that would change the slide's
layout. But if you want to apply from the list of CustomLayouts, you need to
go the route discussed above.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 
Let's say you defined several customlayouts in your slidemaster. If your
want your slide has the third customlayout in your collection do this

ActivePresentation.Slides(1).CustomLayout
=ActivePresentation.SlideMaster.CustomLayouts(3)
Hope this helps
Sergey
 
Back
Top