Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2006

Tip: Looking for answers? Try searching our database.

VBA Code to Return Name of Word 2003 Template of Origin

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PegDalyPA - 08 Sep 2006 19:17 GMT
Hello!

If I'm running a macro on a document that was created from a template, is
there a way to have the macro find out the name of the original template
document and store that name in a variable?

Later in the macro, I want to base a margin change on the original template
since I'm using a single macro to do something to documents created from
various templates.

For instance, when I'm using a macro to insert a landscape section in a
document created from my "8by11 Blank.dot" (which is portrait), the new
landscape section needs a left margin of 1.5", BUT if the document was
created from the template called "8by11 Proposal.dot" (also portrait) it
should get a left margin of 2.5".

Any help would be appreciated.

Thanks!

Peg
Jean-Guy Marcil - 08 Sep 2006 20:02 GMT
PegDalyPA via OfficeKB.com was telling us:
PegDalyPA via OfficeKB.com nous racontait que :

> Hello!
>
[quoted text clipped - 13 lines]
>
> Any help would be appreciated.

Have you tried:
   Dim strDocTemplate As String
   strDocTemplate = ActiveDocument.AttachedTemplate.Name

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

PegDalyPA - 08 Sep 2006 22:15 GMT
Thank you!  That's the 2nd time you've saved me!  :-)
Have a great weekend!

>PegDalyPA via OfficeKB.com was telling us:
>PegDalyPA via OfficeKB.com nous racontait que :
[quoted text clipped - 8 lines]
>    Dim strDocTemplate As String
>    strDocTemplate = ActiveDocument.AttachedTemplate.Name
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.