Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 03-19-2022, 11:29 AM
Charles Kenyon Charles Kenyon is offline Content blocks stop working when changing file path Windows 10 Content blocks stop working when changing file path 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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mapped Content Controls in Building Blocks? Charles Kenyon Word 6 05-21-2021 05:40 PM
Stop hyperlink to a file from changing address - causes problems with pdf c.davidson Word 1 09-15-2020 11:11 PM
Content blocks stop working when changing file path New building blocks have stopped working (Word 2016) Genericname1111 Word 0 05-20-2020 04:17 PM
Content blocks stop working when changing file path Get image path from content control field - NO VBA possible thoerzer Word 5 10-10-2019 12:10 AM
Changing Absolute path to Relative in a Macro MrKim Excel Programming 13 01-26-2019 02:18 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:01 AM.


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