Set slide design template to the default design in VBA

J

jwwarrenva

How can I set the design template for a selected slide to the default
design in VBA?

The way this is done from the Slide Design task pane is that you first
select the slide you want to change, then click on the icon for the
default design template, for which a pop-up reads "Default
Design.pot". You then click on the down-arrow and click on "Apply to
Selected Slides". I need to accomplish this from VBA.

The problem is that the macro recorder yields

ActivePresentation.ApplyTemplate FileName := ""

which doesn't work. You get a "PowerPoint could not open the file"
run-time error if you try to run the recorded macro. To set the
design to something other than the default, you would specify the name
of a .pot file, for example Clouds.pot. (You have to specify the
complete path to the file.) These files are normally found in the
Office Templates\Presentation Designs folder; however, the folder does
not contain a "Default Design.pot". Using ApplyTemplate with one of
the files in the Presentation Designs folder works OK for me, but
attempting to use "Default Design.pot" as the file does not, whether
or not preceded by the path to the Presentation Designs folder.

My environment: Microsoft Office PowerPoint 2003 SP2 under Windows XP
SP2.

Any advice would be appreciated.

Thanks,
John
 
S

Shyam Pillai

ApplyTemplate method requires a physical pot on disk. If you have a
default.pot then you should use that as the argument. If you don't have a
physical template for default then you should use the following:

ActivePresentation.Designs.Add "Blank Design"
This command adds a blank master to the designs collection. You can use any
name you wish. Once the design has been added, you can reference it in your
code and assign it to the slides.


--
Regards,
Shyam Pillai

Image Importer Wizard
http://skp.mvps.org/iiw.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top