@Poremsky.com

Tips & Tricks for Windows, Office, and Whatever

  • Home
  • Windows
  • Office
  • BlackBerry
  • Web Design
  • WordPress
  • Internet Explorer

Create buttons for Word's Building Blocks

Published on November 8, 2012 Last reviewed on May 3, 2017

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.

Dog Ear build blockFor example, if you type dog and press F3, the Dog Ear building block will be inserted into the document.

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… '.

  1. Press Alt+F11 to open the VBA editor.
  2. Right click on the TemplateProject and choose Insert, Module.
  3. Paste the macro into the module then edit.
  4. Repeat as needed.
  5. 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.

Building block organizer

Share this:

  • Facebook
  • LinkedIn
  • Twitter
  • Print
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments

Recent Posts

  • Change Password or Pin Complexity after removing from Intune
  • Server drafts location is not valid error message
  • What is the Brown File Box Icon on Files in Windows 11?
  • Remove Office Licenses from Windows
  • Add the Recent Items Folder to Windows 10 Quick Access

Recent Comments

  • FUAD on Remove Office Licenses from Windows
  • Brian DuBridge on Add the Recent Items Folder to Windows 10 Quick Access
  • Renee Moodie on Remove Office Licenses from Windows
  • John P on Remove Office Licenses from Windows
  • Puja on Remove Office Licenses from Windows
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

© 2023 · @Poremsky.com

wpDiscuz
Go to mobile version
You are going to send email to

Move Comment