PowerPoint 2003: Applying "Default Design" to presentations via VB

M

Mike Clayton

Hello,

I'm hitting a problem trying to assign the "Default Design" template to
presentations using VBA. If I record a macro and perform the actions manually
(Format -> Slide Design -> Default Design.pot) I get the following code:

Sub Macro1()
ActivePresentation.ApplyTemplate FileName:=""
End Sub

If I then try to run this macro I get the following error:

"Run-time error '-2147188160 (80048240)':
Presentation (unknown member): Invalid request. PowerPoint could not open
the file."

I read elsewhere that the file may actually be called "blank.pot" and could
be stored in my user profile but I searched there and had no joy. Does anyone
know what the correct filename and path for "Default Design.pot" is? Or
whether there is a different way to modify a presentation from VBA so that it
ends up based on the "Default Design" template?

Regards,

Mike
 
D

Dr. Stephan Kassanke

Mike Clayton said:
Hello,

I'm hitting a problem trying to assign the "Default Design" template to
presentations using VBA. If I record a macro and perform the actions
manually
(Format -> Slide Design -> Default Design.pot) I get the following code:

Sub Macro1()
ActivePresentation.ApplyTemplate FileName:=""
End Sub

If I then try to run this macro I get the following error:

"Run-time error '-2147188160 (80048240)':
Presentation (unknown member): Invalid request. PowerPoint could not open
the file."

I read elsewhere that the file may actually be called "blank.pot" and
could
be stored in my user profile but I searched there and had no joy. Does
anyone
know what the correct filename and path for "Default Design.pot" is? Or
whether there is a different way to modify a presentation from VBA so that
it
ends up based on the "Default Design" template?

Regards,

Mike

Hi Mike,

you have to assign an existing file to the filename property.

Create your desired design in a powerpoint template, and save it as a ".pot"
(template) file. let's assume you saved to "c:\mypot.pot" . Insert this
value in your code fragment et voila - The design is assigned to the active
presentation (ActivePresentation.ApplyTemplate FileName:="c:\mypot.pot").

cheers,
Stephan
 
M

Mike Clayton

Hi Stephan,

Thanks for your response.

As an experiment I'd already tried the code with an existing pot file and it
all worked as you described. The main problem is that the "Default
Design.pot" that PowerPoint attaches when you do "Format -> Slide Design ->
Default Design.pot" doesn't seem to exist as a disk file anywhere so I can't
specify a path to it in the call to ApplyTemplate.

The only thing I can think of doing is creating a "My Default Design.pot"
file and then attaching that instead of trying to use PowerPoint's built-in
template. I'm concerned then though that there might some nasty side-effects
if someone opens the presentation on a machine that doesn't then have my
custom "My Default Design.pot" copied onto it.

M
 
P

Peter Huang [MSFT]

Hi,

Currently I am researching the issue and we will reply here with more
information as soon as possible.
If you have any more concerns on it, please feel free to post here.

Thanks for your understanding!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

Dr. Stephan Kassanke

Mike Clayton said:
Hi Stephan,

Thanks for your response.

As an experiment I'd already tried the code with an existing pot file and
it
all worked as you described. The main problem is that the "Default
Design.pot" that PowerPoint attaches when you do "Format -> Slide
Design ->
Default Design.pot" doesn't seem to exist as a disk file anywhere so I
can't
specify a path to it in the call to ApplyTemplate.

The only thing I can think of doing is creating a "My Default Design.pot"
file and then attaching that instead of trying to use PowerPoint's
built-in
template. I'm concerned then though that there might some nasty
side-effects
if someone opens the presentation on a machine that doesn't then have my
custom "My Default Design.pot" copied onto it.

M

Hi Make,

if you are distributing the code as an add-in (what really would make
sense), it might be an option to distribute the default pot as well and
reference it via your code.

Powerpoint (still) lacks an object like "ThisPresentation" which references
the presentation the code is currently running in (similar to Excel and
Word). This makes it hard to find out the current presentation (not the
active one). You could cycle through the addin collection to get a suitable
reference. When you find out the presentation, it's easy to reference a
default.pot, e.g. in the same folder, via name and path properties.

cheers,
Stephan
 
S

Steve Rindsberg

Mike Clayton said:
Hi Stephan,

Thanks for your response.

As an experiment I'd already tried the code with an existing pot file and it
all worked as you described. The main problem is that the "Default
Design.pot" that PowerPoint attaches when you do "Format -> Slide Design ->
Default Design.pot" doesn't seem to exist as a disk file anywhere so I can't
specify a path to it in the call to ApplyTemplate.

That's correct ... the blank template is, in effect, hardwired into PPT.
The only thing I can think of doing is creating a "My Default Design.pot"
file and then attaching that instead of trying to use PowerPoint's built-in
template. I'm concerned then though that there might some nasty side-effects
if someone opens the presentation on a machine that doesn't then have my
custom "My Default Design.pot" copied onto it.

I don't think so. Once a template's applied to a presentation, there's no
connection whatever back to the original template file. All the needed
template info is slurped into the PPT itself.

Which leads to another suggestion: any time you need a blank template via
code, create a new blank presentation, save it to a temporary name as a
template, then apply it to the presentation you want to format.

This would have one side effect that you may or may not find desirable:

If the user has created their own blank template as a file, then all new blank
presentations will follow that template rather than PPT's built-in defaults.
The user's defaults will apply.
 
P

Peter Huang [MSFT]

Hi Mike,

Based on my research, there are no such a file named default.pot.
So far you may try to save the default ppt file as default.pot and applied
it to your PPT when you want.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Mike Clayton

Thanks everyone for your input.

I think what I'm going to do is create my own blank "Default Design.pot"
which I'll distribute with my add-in. When the code attaches it to a
presentation it'll then say "Default Design" in the status bar of the main
PowerPoint window as if it were a new blank presentation, and the user will
be none the wiser.

M
 

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