Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply particular layout in powerpoint using vba?

Tags:

powerpoint

vba

I am working on one project. In that I made one custom theme which includes one master slide and may layouts. so basically i want to apply particular layout to specific slides. So is there any way to do it by programmatically. like :

activepresentation.Slides(1).Layout="layoutname"

I know above code is wrong but i want something like this to call particular layout by its name. for your information my layout name is "Title without Client Logo".

Thanks

like image 557
Pratik Gujarathi Avatar asked Feb 05 '12 07:02

Pratik Gujarathi


People also ask

How do I create a custom layout in PowerPoint?

Open the PowerPoint template and select the View tab. Click the Slide Master icon in the Master Views section. From the Slide Master view, you can edit, create, and rename slide layouts for the template presentation.

How will you apply the design template to some chosen slides only?

Select the slide to which you want to apply the design. On the Design tab, right-click the design in the Themes group, and then click Apply to Selected Slides.

How do I add a blank slide in PowerPoint VBA?

Press ALT + F11 to get into the VBA editor, add a new module and paste the code above into the new module. During a show, clicking the shape will add a new blank slide after the current slide.


1 Answers

ActivePresentation.Slides(1).CustomLayout = ActivePresentation.Designs(1).SlideMaster.CustomLayouts(x)

where x is the index into the layouts collection that represents your custom layout.

Unlike most other such collections in the PPT OM, this one seems unable to accept either an index or a name. It must be an index.

If you need to work with the name, write a function that iterates through the CustomLayouts collection until it finds the name you're after and returns the index.

like image 114
Steve Rindsberg Avatar answered Sep 21 '22 07:09

Steve Rindsberg