#1
|
|||
|
|||
VBA Code to Access Building Block Template in Word 2013 Startup folder
I have the following macro to insert a building block into a document:
Sub OpsTech() ' ' OpsTech Macro ' ' Application.Templates( _ "C:\Users\robert.ross\AppData\Roaming\Microsoft\Wo rd\STARTUP\BBTechTemplate.dotx" _ ).BuildingBlockEntries("Ops Tech").Insert Where:=Selection.Range, _ RichText:=True End Sub I need to modify this so it is not user specific. Multiple writers will have this template installed in their Startup folder. |
#2
|
||||
|
||||
That is fairly straightforward e.g.
Code:
Dim strPath As String 'strPath = Environ("AppData") & "\Microsoft\Word\STARTUP\BBTechTemplate.dotx" 'or to account for users who may have moved the startup folder strPath = Application.Options.DefaultFilePath(wdStartupPath) & "\BBTechTemplate.dotx" Application.Templates(strPath).BuildingBlockEntries("Ops Tech").Insert _ Where:=Selection.Range, _ RichText:=True
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Seems to work
Thank you! It works on my machine. Now I need to test it on another persons machine to make sure it works for them as well.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA Word - Building Block (AutoText) - Array - Replace Text with Specific Building Blocks | jc491 | Word VBA | 7 | 01-03-2016 10:34 PM |
A yes or no OptionButton in Userform inserts a building block | HighSierra | Word VBA | 3 | 06-14-2015 11:19 PM |
How to share building block macros? | rdross51 | Word VBA | 7 | 03-12-2015 08:59 AM |
Custom Building Block File Locations | ptmuldoon | Word | 5 | 01-03-2015 08:45 AM |
Building blocks show correctly in dropdown, but wrong building block populates in doc | wordgirl123 | Word | 0 | 10-03-2013 08:30 AM |