Expert Zone
DOC + DOCX repair tool
HomeExpert ZoneWordThis page

Add Interactive Toggle Objects to Word Documents

By

Greg Maxey

This article shows you how you can incorporate interactive check boxes in unprotected Word documents. The process involves creating a pair of AutoText entries consisting of a MACROBUTTON field that displays a symbol (a cleared or a checked box) and applying a few simple macros that will run when you double-click the displayed symbol to toggle between the two symbols. As an alternative you might prefer a cleared box and a "x" marked box or any any symbol pair (see the examples below).

  1. Open a new blank document. Just to make things easier, save it now with any name. You can delete it later when finished with this process. Next, if not already displayed, use the View>Toolbars menu to display the Format toolbar. In the Style window, type Checkboxes and press enter. This creates a style, but more importantly in this case it creates a category in Autotext to hold your checkbox symbol entries. Tip: AutoText categories are simply a list of styles where one or more AutoText entry has been created with that style applied.

  2. Without moving the cursor, Press CTRL+F9 to enter field code delimiters "{ }." In the delimiters type "MACROBUTTON Checkit " then use the Insert>Symbol menu to insert a clear box. See illustrations below:

  3. Now define the first Autotext entry. Select the entire field code (do not select the paragraph mark at the end of the field) and press ALT+F3. This opens the "Create AutoText" dialog box. Name the AutoText entry "Unchecked Box" as shown below and press "OK." Tip: You might want to display non-printing characters (CTRL+SHIFT+*) to make it easier to select just the field code.

  4. Now define the second AutoText entry. Using the keyboard and Insert>Symbol menu, change the field code as shown below. Then select the revised field code and press ALT+F3. Name this AutoText entry "Checked Box." Tip: You can choose the "X'd" box at this point if you prefer.

  5. You have now created two AutoText entries. One displays a cleared box and one displays a checked box. As you have seen from the construction these symbols are nested in a MACROBUTTON field. One field fires a macro labeled "Checkit" and the other field fires a macro labeled "Uncheckit." The next step is to create these two macros that make the symbols interactive.

  6. Macros tell Word to do something when they are fired. In our case we want Word to replace a cleared box with a checked box when the macro labeled "Checkit" is fired and replace a checked box with a cleared box when the macro labeled "Uncheckit" is fired. The required macros are provided below. Applying macro code to your VBA project is beyond the scope of this page. If you are unfamiliar with this process please see fellow MVP Graham Mayor's Guide for Installing Macros.

    Sub CheckIt()
    ActiveDocument.AttachedTemplate.AutoTextEntries("Checked Box").Insert
    Where:=Selection.Range
    End Sub
    
    Sub UncheckIt()
    ActiveDocument.AttachedTemplate.AutoTextEntries("Unchecked Box").Insert
    Where:=Selection.Range
    End Sub
  7. With the macros placed in the VBA Project of your template you are ready to start using your new interactive checkboxes. Before you do, be sure that you save the changes that have been made to your template. Hold down the SHIFT key and select File>Save All. Save All will ensure the AutoText and macro entries in your template are saved. Or if you have your system setup to prompt you of any changes to your template then answer yes to the prompt.

  8. Your Insert>AutoText Menu now has a new category named "Checkboxes." Select this category whenever you want to place an initially checked or unckecked box in your document.

  9. Like any AutoText entry, the checked or unchecked box can be inserted as you type when your system is configured to "Show AutoComplete Suggestions." Simply begin typing check.. or unche.. and when the AutoComplete tip appears press enter.

  10. Go ahead and enter a few and give it a try. Viola, your boxes are interactive!!

    If Mid$(ActiveDocument.Fields(1).Code, 14, 7) = "Uncheck" Then

  11. If you are not up to the task of creating your own checkboxes then I have done it for you (I was bored)

    Toggle Objects.zip

    The template contains a toolbar shown below for entering each of the interactive symbols.

    Unzip the file to your Word>Startup directory so it will load as a global template making the AutoText entries, macros, and toolbar available in all your Word documents. You can click on Installing an Using Global Addins if you need help or further explanation on using templates and addins.

This website uses cookies to manage sessions, forms, statistics and others. More information.