Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Applying a template in a macro for PowerPoint

I cannot get the Apply Template to work. Any ideal what I am doing wrong?

sub ExportToPowerPoint
'Create ppt object
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Add

'Apply a template if you want one
objPresentation.ApplyTemplate _
("C:\SampleTemplate.potx")

' Create Slides
' Same Slide - 2nd Slide
Set PPSlide = objPresentation.Slides.Add(1,1)
ActiveDocument.GetSheetObject("Slide2").CopyBitmapToClipboard
PPSlide.Shapes.Paste

end sub

4 Replies
Not applicable
Author

Has anybody found a resolution to this issue with applying an existing template - I have been running into the same error myself

Any help would be grealy apprecaited.

Gysbert_Wassenaar

This page indicates you don't use parentheses around the template file name. If that doesn't help you, ask somewhere where they specialize in ms-office scripting. You'll have a better chance of an answer in such a place.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks the parentheses don't seem to do it but you've definately pointed me in the correct direction with respect to looking more into ms-office resources. There's a lot more information around this on those pages. I'll let you know of the outcome!

Not applicable
Author

this works for me  - simple enough solution in the end !

 


objPresentation.ApplyTemplate("C:\Documents and Settings\mytemplate.pot")