Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-01-2013, 11:30 PM
tinfanide tinfanide is offline PowerPoint VBA: ApplyTemplate & absolute path Windows 7 64bit PowerPoint VBA: ApplyTemplate & absolute path Office 2010 32bit
Expert
PowerPoint VBA: ApplyTemplate & absolute path
 
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
  #2  
Old 04-02-2013, 12:27 PM
JohnWilson JohnWilson is offline PowerPoint VBA: ApplyTemplate & absolute path Windows 7 64bit PowerPoint VBA: ApplyTemplate & absolute path Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

How would the template file be found if you didn't specify the path?

Anyway you have to!

You can also try

oPowerPoint.Presentations.Open Filename:="C\Users\Tin\Desktop\test.potm", Untitled:=True
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #3  
Old 04-05-2013, 07:28 AM
tinfanide tinfanide is offline PowerPoint VBA: ApplyTemplate & absolute path Windows 7 64bit PowerPoint VBA: ApplyTemplate & absolute path Office 2010 32bit
Expert
PowerPoint VBA: ApplyTemplate & absolute path
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

Quote:
Originally Posted by JohnWilson View Post
How would the template file be found if you didn't specify the path?

Anyway you have to!

You can also try

oPowerPoint.Presentations.Open Filename:="C\Users\Tin\Desktop\test.potm", Untitled:=True
Yes, ya're right.
I just thought my file that has the codes is on the same directory with the template file. I thought I'd use relative paths for reference.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for absolute text box re-position hobbsbaboo PowerPoint 0 03-15-2012 01:44 AM
PowerPoint Motion Path Triaba PowerPoint 1 12-19-2011 12:47 AM
How do I align image at ABSOLUTE top left of a table cell? shnoozin Outlook 0 07-22-2011 03:30 PM
PowerPoint VBA: ApplyTemplate & absolute path How To Get Image to be absolute center of slide mjg060468 PowerPoint 3 08-09-2010 02:07 PM
truncating path or renaming audio file to play in powerpoint rbookend PowerPoint 0 05-02-2006 03:39 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:34 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft