Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-16-2014, 09:53 AM
XmisterIS XmisterIS is offline how to determine the full path of the template from which a document was created? Windows 7 64bit how to determine the full path of the template from which a document was created? Office 2007
Novice
how to determine the full path of the template from which a document was created?
 
Join Date: Sep 2013
Posts: 12
XmisterIS is on a distinguished road
Default how to determine the full path of the template from which a document was created?

Let's say I can create a document from a template ("C:\some\arbitrary\path\mytemplate.dotm", for the sake of argument). How can I programmatically get the full path of the template from which the document was created?
Reply With Quote
  #2  
Old 06-16-2014, 10:18 AM
jpb103's Avatar
jpb103 jpb103 is offline how to determine the full path of the template from which a document was created? Windows 7 64bit how to determine the full path of the template from which a document was created? Office 2007
Advanced Beginner
 
Join Date: May 2014
Location: Thunder Bay, Ontario
Posts: 58
jpb103 is on a distinguished road
Default

In the VBA window, click "Tools" and then "References...". Ensure that the checkbox next to the template in question is checked. To get the path of this template, use the following code:
Code:
mytemplate.ThisDocument.Path
Where "mytemplate" is the name of your template. I think that should work.
Reply With Quote
  #3  
Old 06-16-2014, 04:15 PM
macropod's Avatar
macropod macropod is offline how to determine the full path of the template from which a document was created? Windows 7 32bit how to determine the full path of the template from which a document was created? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The VBA code for retrieving the active document's template path is:
ActiveDocument.AttachedTemplate.Path
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Document Filename Generator for Referencing john.adams Word 10 03-26-2013 12:14 AM
how to determine the full path of the template from which a document was created? Save Filename using Document Text Knawl Word 11 10-10-2011 03:00 AM
how to determine the full path of the template from which a document was created? Office 2010 Template Loses Its Filename On Open MYGS Word 14 06-02-2011 09:44 PM
Macro to determine attached template zippyaus Word VBA 0 03-02-2010 02:05 AM
Word: The document 'Filename' caused a serious error the last time ... martincruise Word 0 02-25-2010 01:47 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:08 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