Personal website of Gregory K. Maxey, Commander USN (Retired)
Do you have ad-blocking software enabled? While I respect your right to do so, your donations and the minimal advertisements on this site help to defray internet and other costs of providing this content. Please consider excluding this website from blocking or turning off the blocker while browsing this site.
The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.
However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.
If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!
This Microsoft Word Tips & Microsoft Word Help page serves to publish and describe my Search & Insert Building Blocks Utility Add-In.
Several years ago, I had cobbled together a process to search and list template building blocks containing a defined text string. I was recently reminded of that process in a support forum post. The original poster referred to my old code which I had completely forgotten about. Age takes its toll!
The post got me interested in refining and expanding the process which has resulted in this add-in.
A BuildingBlock (building block) is part of the Word object model just like words, paragraphs and sections are. Like other object model members, they have properties and methods that a developer can use.
The building block ".Value" method returns a text string defined in the building block. Finding a text string in a building block would be purely elementary if not for two underlying shortcomings of this property.
To search building blocks longer than 255 characters or building blocks defining one or more shape object, the building block must be inserted in a physical document range. This add-in uses a temporary transparent document as this physical range. Using a physical range, we can further expand the capability to search for text in a building block using Word's Find methods (including wildcard searches). For the purpose of this discussion I have chosen to call this "physical range" search method a deep dig building block search.
The add-in is compatible with Word 2007-2019. When loaded manually or automatically on startup, the add-in appends a control group with a single button control to Word's built-in Insert tab and a single launch icon on Word's QAT.
Note: The graphics used to create this tips page where made using Word 2016. With future updates, captions and labels appearing in the graphics may not accurately reflect the current version captions or labels.
On first use, the add-in Disclaimer page is displayed. Users should read and must acknowledge the disclaimer before using the add-in features.
After acknowledging the disclaimer, the main dialog with default configuration is presented. The main dialog consist of three control frames, a "Resting Anchor" logo link, Close command button and "Donate" link. Each control frame contains a "Info\Help" command button you can use to obtain more information on using the controls.
The default scope is is all building blocks in all galleries contained in the active document attached template. The default scope includes text content in the text range of any shape objects defined in the building block.
The Normal, Attached, Built-In and All Templates options and the Include shape text in search option are sticky options. For example, if you set the scope to include the attached template and Normal template for a search. Those settings stick (until changed) and are applied to all future searches.
The Gallery "All" option is always the default when the utility is launched. You can refine the scope to one or more selected galleries.
The textbox and checkbox controls in the Find frame are used to define the word, phrase or complex text (wild card search) to search for.
When using wildcards, use the standard Word wildcard conventions. See Graham Mayor's Replace Using Wildcards
Note - Use of the ""Match Whole Word"" or ""Use Wildcards"" options requires a deep dig search.
You can use "Show Progress Bar(s)" for large scope searches or searches involving several deep dig searches.
Note -Showing progress bars slows the search process marginally.
The Execute Search command button is only enabled when both scope and search are defined.
Show Progress Bar(s) is a sticky option. Match Case, Match Whole Word and Use Wildcards are not sticky options.
Effect of Scope and Find Options On
The scope determines the number of building blocks that must be searched to finish and display the result. Therefore, the larger the scope the longer the search will take.
In cases where a building block meets "deep dig" criteria (defined earlier) or use of a Find option that requires a deep dig search, the process must create a temporary transparent document to evaluate the building block content. This adds marginally to the time required to finish the search and display results.
Your PC characteristics will of course also affect processing time.
The building blocks found based on the scope and find options selected are listed as found blocks by name, description (if defined), gallery index, category name, insert option (index) and template name.
Only the building block name and description (partial description), if defined is initially displayed. The horizontal scroll bar can be used to review the remaining data. The graphics below depict the results searching my Built-In Building Blocks template for using the search term "urgent"
Legends showing gallery index to gallery name and insert option index to insert option function is shown below:
Unsorted, the found building blocks are listed as found during the search of each template in the defined scope. The list may or may not be alphabetical.
To sort the list alphabetically (for all building blocks found) check "Sort by name." Sort by name is a sticky option.
Using one of the two command buttons provide, you can insert a selected building block in the document and close the dialog or insert a selected building block in the document leaving the dialog open. With the dialog open, you can reposition the cursor in the document and continue to select and insert building blocks. Both buttons enable when a found building block is selected.
The Resting Anchor logo provides a link to this website.
Launches a link to my PayPal account to make donations. Probably the most under used control in any add-in that I have ever developed!! A tremendous amount of work has gone in to developing this tool and tips page. If you feel that it has enhanced your productivity then please consider making a donation.
The following graphics illustrate a search of my Built-in Building Blocks template for the term "urgent" where I've searched in all galleries with progress bars displayed.
With my system the search took 11-12 seconds. Without the progress bars the search took about 10 seconds.
That's it! I hope you find the add-in useful and this tips page helpful and informative. You can download the add-in here.
Do you want to make a payment for consulting work or donate to help support this site?
PayPal is a safe, easy way to pay online.
Use the appropriate currency "Donate" button to make a payment or donation.