Personal website of Gregory K. Maxey, Commander USN (Retired)
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 was inspired by a Word support forum question "How do I select a complete sentence that contains abbreviations?" Microsoft provides many options for selecting text. The option for selecting a sentence (hold down the control key and click anywhere in the sentence) is included in the methods listed here Select Text. If you are familiar with this method or the "Extend Selection" method using the "F8" key then you have no doubt experienced frustration at one point or another. Consider the following sentence examples.
Problem: the built-in Microsoft defined “Sentences” collection is flawed and incomplete.
From Word's perspective the second example sentence is considered three (3) separate sentences shown below.
Solution: "Deduced Sentence Selector©" is a template add-in designed for use with Microsoft Word.
Jason can take credit for the bulk of the success of the "sentence class" used in this project!
When completed, I realized that the Add-In solution may be a bit oversized for the original problem. Still the study of the problem and the subsequent development of code, the class, and the interface were a rewarding experience and interesting challenge. I have learned a few things. I think my co-developer Jason Simpson has learned a few things. It may be useful to you the user; and if you are interested in developing and using class objects in your VBA solutions or in advance ribbon customization then you also may learn a few things and benefit our efforts.
Note: Due to several enhanced features in the Word 2007\2010 Ribbon User Interface (UI), the add-in UI is slightly different in Word2003. This tips page covers only the Word 007/2010 version.
The UI includes a custom ribbon tab "DSS© ." The custom tab appears before the home tab and contains the controls for demonstrating the class and using the add-in.
The far left ribbon command "Setup Form & Navigation" calls and displays the Userform UI (created for use in the Word2003 version of the Add-In) and several advanced setup interface controls. The Userform UI has a "compact" and "expanded" view as shown below. Use the "More" and "Less" controls to change the view.
Note: While the "capabilities" of the class are identical in both versions of the add-in, the employment of the class is expanded in the Word2007/2010 version. Notice the addition of "Paragraph Information" in the ribbon interface above. This information is available from the class and I used some advanced ribbon customization procedures to display it in the ribbon UI.
The class is capable of returning deduced sentences in one of four distinct styles (or definitions) as shown in the below dropdown list.
Note: The "Standard" style, unlike Microsoft, does not include trailing paragraph marks.
The key requirement in deducing real sentences is to identify and eliminate the false sentences that the native sentences collection returns due to using periods to construct abbreviations.
Note: Checking the "Show flags in ribbon" checkbox in the "Advanced Setup" panel of the Userform UI lets you display and edit the class flags directly in the ribbon using edit box controls. Jason isn't convinced this feature is worth the ribbon space it takes, but I simply couldn't resist the opportunity to demonstrated another example of the superiority of the ribbon over the old command bar interface.
Can any classic menu proponent replicate this feature with command bar controls?
In addition to deducing real sentences, Jason and I have included properties in the sentence class that can be used to deduce and identify manual list numbering used in a document. Manual list numbering, as opposed to list paragraphs, is numbering entered directly by the document author user as a simple string of text. For example the document author may type:
Note: While I don't advocate manual numbering, it occurs in documents and simple lists all the time. This fact prompted Jason and I to use it as an experiment for expanding the usefulness of the sentence class. Hopefully it will illustrate how developers could expand the sentence class by adding additional properties or methods to meet other custom requirements.
The following illustrates how using the properties of the class and the ribbon controls "Indentify Lists" and "Include enumerators" effects the information displayed.
The class can evaluate and deduce several formats and variations of manual list numbering. Examples are included in the template. Also included in the template are examples illustrating scenarios where the class cannot with any degree of certainty deduce a manually enumerated list. One such example is shown below.
The Add-In includes several procedures that allow you to employ the properties of the class to perform functions on deduced sentences. These are grouped and labeled "Deduced Functions" in the UI. Using these procedures together with one of the "sentence styles" defined by the class you can easily select, apply formatting or delete deduced sentences.
The UI "Navigation & Paragraph Information" group contains controls and labels that allow you to easily navigate deduced sentences and review information about the parent paragraph.
1. Using the "Previous" or "Next" commands you can continue beyond the boundary of the parent paragraph and continue selecting and reviewing deduced sentences until your reach the beginning or end of the document.
2. Use the "Refresh" button to update parent paragraph information as required when you edit or add additional text.
Demonstrations of the class and the various styles are provided in the UI "Class Demos" group.
Information about the class and a user disclaimer is provided in the UI "Help" group.
Two additional procedures are provided with the Add-In (initiated using QAT commands) that demonstrate using the class properties and external procedures to perform additional tasks.
That's it! I hope you have found this tips page useful and informative. You cand download the add-in here: Dededuced Sentences.
For more on template add-ins and how to load them, see the heading "Organizing Global Templates" at: Organizing Your Macros.
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.