Resting Anchor

The Anchorage

Personal website of Gregory K. Maxey, Commander USN (Retired)

Content Control Help Text
(A Microsoft Word Help & Tip page by Gregory K. Maxey)

DISCLAIMER/TERMS OF USE

The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.

Click to acces PayPal Verification Service Click to acces PayPal Verification Service

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!

Click to donate British Pound Sterling                   Click to donate US dollars                   Click to donate EU euros

This Microsoft Word Tips & Microsoft Word Help page provides several methods of providing content control "Help Text" prompts for your document users.

Legacy Form Field Help Text

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.

Site Note IconNote: The field options dialog box is displayed by double-clicking a form field with protection mode off.

cc_helptext_01

Clicking the "Add Help Text" control displays a dialog offering several methods you can use to define and display your Help Text

cc_helptext_02

You can type your own Help Text and display it in the Status Bar

cc_helptext_02A
Status Bar display

cc_helptext_03

You can type your own and display it in a Help Text dialog box

cc_helptext_03A
Help Text dialog display

cc_helptext_04

You can use pre-defined AutoText entries to display in either a Help Text
dialog or the Status Bar

cc_helptext_05

Here a pre-defined AutoText entry provides the Help Text

Content Control Help Text

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.

cc_helptext_06
Document Content Controls

cc_helptext07

Help Text is displayed in the Status Bar when the user enters the Content Control

cc_helptext_08

Help Text is displayed in a message box when the user presses Alt+h
(note the message box text is defined in the VBA code)

cc_helptext_09

Help Text is displayed in a message box when the user presses Alt+h
(note the message box text is defined using an AutoText entry)

More Help Text for Content Controls

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.

cc_helptext_10

Modeless UserForm displays custom Help Text

And finally, Content Control Placeholder Text can be easily modified to provide basic Help Text.

cc_helptext_11

Placeholder Text Defined as Help Text

cc_helptext_11

Use "Design Mode" to redefine default Placeholder 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:

cc_helptext_12

Code for the ThisDocument and mod_Main standard modules is provided below:

VBA Script for ThisDocument Module:
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).

VBA Script mod_Main:
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.

cc_helptext_14

The frmHelpText module contains no code. It consists of a simple userform object with two label controls.

cc_helptext_15

Site Note Icon 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

Share

DISCLAIMER/TERMS OF USE

The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.

Click to acces PayPal Verification Service Click to acces PayPal Verification Service

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!

Click to donate British Pound Sterling                   Click to donate US dollars                   Click to donate EU euros

Search my site or the web using Google Search Engine

Google Search Logo