I use Word's Building Blocks (Quick Parts) to hold blocks of text I insert into invoices but using the Building Blocks Organizer to insert blocks is slow and the names I gave my blocks are too similar, so I can't quickly type in part of the name and press F3 to insert the block.
If you type enough of the building block name to be unique, you can press F3 to insert it.
This building block adds a note icon to the footer, as seen in the screenshot on the right.
Use VBA to insert a building block
To insert the building block using VBA, you need just a couple of lines of code in the macro. You can repeat this macro as many times as needed, but will need to use a unique name for each copy of the macro. (I use the building block name as the macro name.)
You need to know what template the building blocks are in. My building blocks are in my invoice template; if yours are in the normal.dotm template, you'll use that filename. If the template is in the user template folder, you only need the template name.
You also need the name of the building block.
Sub BuildingBlockMacro() Dim oTmp As Template Dim sPath As String sPath = Options.DefaultFilePath(wdUserTemplatesPath) & "invoice.dotm" Set oTmp = Templates(sPath) oTmp.BuildingBlockEntries("Building Block Name").Insert Selection.Range End Sub
To use the macro, set Word's macro security to 'Enable all… '.
- Press Alt+F11 to open the VBA editor.
- Right click on the TemplateProject and choose Insert, Module.
- Paste the macro into the module then edit.
- Repeat as needed.
- Return to Word and create buttons on the ribbon or QAT for the macros.
Building Block Organizer
Select a building block from the organizer to insert into a document.