View Single Post
 
Old 04-01-2013, 11:30 PM
tinfanide tinfanide is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default PowerPoint VBA: ApplyTemplate & absolute path

Code:
''' in Excel
Sub GenerateQuizSlides()

Dim oPowerPoint As Object, oPresentation As Object

Set oPowerPoint = CreateObject("PowerPoint.Application")
oPowerPoint.Visible = True
Set oPresentation = oPowerPoint.Presentations.Add(WithWindow:=msoTrue)

'' error
'' Run-time error '-2147188160 (80048240)':
'' Automation error
oPresentation.ApplyTemplate Filename:="test.potm"
''

'' no error
''oPresentation.ApplyTemplate Filename:="C:\Users\Tin\Desktop\test.potm"
''

oPresentation.Close
oPowerPoint.Quit
Set oPresentation = Nothing
Set oPowerPoint = Nothing

End Sub
Why does ApplyTemplate need absolute paths of files?
Reply With Quote