View Single Post
 
Old 03-19-2022, 11:29 AM
Charles Kenyon Charles Kenyon is offline Windows 10 Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,474
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
See Using VBA to Insent an AutoText Entry or other Building Block.
Have your macro and the building block in the same template and use the fullname of ThisDocument as your source location.
Quote:
Originally Posted by gorkac View Post
how do I do that?
Save both the building block and the macro in the same template. You can decide where to save both of these as you create them or move them later. Where can Building Blocks be stored? Organizing your macros by Beth Melton, Word MVP

In that situation, the location of your building block for your code will be in the template:
Code:
ThisDocument.Fullname
ThisDocument always refers to the name of the document that holds the macro. Fullname gives both the name and path automatically.

If the building block is used in multiple templates, it should be in a loaded global template and have a unique name. In that case, look at the macro for situation 3 on my linked page.
Reply With Quote