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 provides several methods of providing content control "Help Text" prompts for your document users.
Users familiar with legacy form field protected forms may be familiar with the Help Text features available with these controls. For those of you who are not, I'll provide a brief overview. The following series of illustrations demonstrates three legacy form fields and the various methods for provided user Help Text.
Note: The field options dialog box is displayed by double-clicking a form field with protection mode off.
There are no true built-in Help Text features for content controls. However, using VBA each of the methods available for legacy form fields can be duplicated and more!
The following illustrates three Content Controls that have Help Text features similar to the features available in legacy form fields. When you enter the “Dogs” CC the Help Text automatically displays in the Status Bar. For the “Cats and Birds” CCs, press Alt+h to display the Help Text dialog.
Additionally, a modeless userform can be employed to display content control Help Text. It performs similarly to the Help Text dialogs, but offers features for a richer user experience.
And finally, Content Control Placeholder Text can be easily modified to provide basic Help Text.
So there they are. Five methods for providing Content Control Help Text for you document users.
Unfortunately, except for the Placeholder Text methods, each of the other methods require a VBA solution with a bit of work. However, once set-up, you might find the results worth your efforts.
The VBA methods require use of the ThisDocument object of the project, a standard code module, and in the case of the modeless UserForm method, a form module. The three project modules are show below:
Code for the ThisDocument and mod_Main standard modules is provided below:
Option Explicit Private Sub Document_ContentControlOnEnter(ByVal ContentControl As ContentControl) Set oCurrentCC = ContentControl If ContentControl.Tag = "HelpMethodA" Then mod_Main.CCHelp End If lbl_Exit: Exit Sub End Sub Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, _ Cancel As Boolean) If Not oFrmHelp Is Nothing Then Unload oFrmHelp Set oFrmHelp = Nothing End If Set oCurrentCC = Nothing lbl_Exit: Exit Sub End Sub Private Sub Document_New() mod_Main.InitializeKeys lbl_Exit: Exit Sub End Sub Private Sub Document_Open() mod_Main.InitializeKeys lbl_Exit: Exit Sub End Sub Private Sub Document_Close() CustomizationContext = ActiveDocument.AttachedTemplate KeyBindings.ClearAll End Sub
The ThisDocument code module contains the Document_ContentControlOnEnter and OnExit event procedures. There are used to detect user actions and define the content control of interest. The module also contains the Document event procedures. These procedures are used to action KeyBinding (i.e., make Ctrl+Shift+F1 display the Help Text).
Option Explicit Public oCurrentCC As ContentControl Public oFrmHelp As frmHelpText Sub CCHelp() Dim oTemplate As Word.Template If Not oCurrentCC Is Nothing Then Select Case oCurrentCC.Tag Case "HelpMethodA" Application.StatusBar = oCurrentCC.Title & _ ": Type your species and chase the cat!" Case "HelpMethodB" MsgBox "WARNING" & vbCr + vbCr _ & "There is a dog on your tail! " & vbCr _ & "Type your species as fast as you can and chase the bird!", _ vbInformation, oCurrentCC.Title Case "HelpMethodC" Set oTemplate = ThisDocument.AttachedTemplate MsgBox "WARNING" & vbCr + vbCr _ & oTemplate.AutoTextEntries(1).Value, _ vbInformation + vbOKOnly, oCurrentCC.Title Case "HelpMethodD" Set oFrmHelp = New frmHelpText With oFrmHelp .Caption = oCurrentCC.Title With .lblHelpHeading .Caption = "WARNING" .TextAlign = fmTextAlignCenter .Font.Bold = True .Font.Size = 16 .ForeColor = wdColorRed End With .lblHelp.Caption = "Oh no!! There is a bird on your tail!" & vbCr _ & "Type your species as fast as you can and flee for your life!" .Show vbModeless Application.Activate End With Case "YourCC1TagHere" 'User a modified version of one of the methods illustrated above. Case "YourCC2TagHere" 'User a modified version of one of the methods illustrated above. Case Else 'There is no help for this content control. End Select End If lbl_Exit: Exit Sub End Sub Sub InitializeKeys() CustomizationContext = ActiveDocument.AttachedTemplate KeyBindings.ClearAll CustomizationContext = ActiveDocument.AttachedTemplate KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyH), _ KeyCategory:=wdKeyCategoryMacro, _ Command:="CCHelp" lbl_Exit: Exit Sub End Sub
The standard module mod_Main contains the code that displays the various Help Text methods employed and establishes the KeyBinding. The key to this code is the ".Tag" property assigned to the various content controls. For example, the "Dogs" content control has "HelpMethodA" assigned to its ".Tag" property.
The frmHelpText module contains no code. It consists of a simple userform object with two label controls.
Note: Special thanks to Word MVP Jay Freedman for his interest and assistance creating this tips page.
That's it! I hope you have found this tips page useful and informative. You can download a demonstration template for this tips page here: Content Control Help Text Demo
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.