Content Controls for macOS – Cool Code

June 2023 Update: I’ve created a VBA add-in for Word for Mac that allows you to more easily add Content Controls in Word documents, with an interface similar to the Windows version. I’m looking for beta testers for this add-in. If you have time to test, please email me (my address is in the Meet the Author sidebar).

Content Controls are an improved form of fillable form field, but the Word for Mac user interface doesn’t include Content Controls for macOS. I show you how to sidestep this limitation to be able to create superior fillable forms.

Microsoft Word for Windows has three different types of fields to use for fillable forms. The oldest of these are Legacy Form Fields, which exist in every version of Word, Windows and Mac, but not DOS, back to the dawn of time. Legacy form fields require the document to be protected for forms, which closes down many formatting options even on unprotected sections. These are the only form fields available in the Mac program interface. Windows version also have ActiveX controls. These generally have a crude appearance. They don’t work at all on Mac versions of Word.

Finally, we have the newest type of form fields, Content Controls. These were introduced on Windows in Word 2007. The collection of controls was expanded a little in 2010 and a little more in 2013. Word 2008 and 2011 can’t use or create them, but in Word 2016 for Mac, the program started honoring Content Controls created in Windows, so they work as expected on both platforms. Unfortunately, the tools to add and modify them are still not in the program.


Content Controls for macOS: What Are They?

While Legacy Form Fields have only 3 types (Text field, Checkbox and Dropdown), there are 9 (or 10, depending on how you count) types of Content Controls. Here’s a look at each type:

Plain Text and Rich Text
Plain Text and Rich Text Appearance

These look identical on the screen. The screen shot shows what they look like unselected (top) and selected (bottom). The Plain Text control is most similar to the Legacy Text form field. All the text has the same formatting and you can’t include other types of content other than text. By comparision, the Rich Text control allows selected text to be bold or italic or a different font. You can insert tables and pictures and even other Content Controls into Rich Text controls.

Picture
Picture Control Appearance

Finally! A true picture placeholder for Word! The picture can be set when the control is created. There are options to allow the user to replace it or not. Or it can be left blank (as shown) for the user to add a picture later. You can change the shape from a square using Picture Format>Picture Styles. This choice can also add a soft edge or other visual effects to a photo that the user inserts later.

It’s worth noting that Picture Content Controls only work as inline pictures. To float them and wrap text around them, you need to place the CC in a table cell or frame or some other object that allows text wrapping. These controls come in at 2″ square, but you can set numeric dimensions on the Picture Format tab. (Thanks to Timothy Rylatt for the tips!)

Building Block
Building Block Control Appearance

This is the only Content Control that doesn’t work yet on a Mac. While Building Blocks in the Windows version of Word is the same technology as AutoText on the Mac, Microsoft hasn’t gone the extra mile to make it work on a Mac. The macro further down the page sets the control to work with AutoText (as you almost always should if your template is being distributed to others). But when you click on the control’s AutoText tab, a dropdown list of AutoText entries doesn’t appear like it does in the Windows version.

At least if your Windows client needs it in their template, you can create it on a Mac. AutoText works by grabbing content from the active document’s attached template. If you’re sending a template with AutoText content, the Content Control will find that. If you’re sending a document instead of a template, the Content Control will grab AutoText from the user’s Normal.dotm file.

Check Box
Checkbox Appearance

Similar to the Legacy Check Box form field, but with the added advantage that the filled symbol can be set to other symbols than an X. This control was added in Word 2010, so don’t include one for a client using 2007.

But still no radio buttons? Give me a break, Microsoft! Using elaborate VBA kludges, it’s possible to make a set of checkboxes operate like radio buttons with both Legacy and Content Control versions. But it shouldn’t be so hard!

Combo Box and Drop-Down
ComboBox and Dropdown Appearance

Another similar pair of controls. The Drop-Down is most similar to the Legacy Drop-Down (which MS often refers to as a Combo Box, just to confuse everyone). The Drop-Down restricts users to choosing an item on the list, while a Combo Box allows a user to enter a value that is not on the list.

Date Picker
Date Picker Appearance

While Legacy Text fields have a date option, it’s only to enforce date formatting after a user tries to enter a date. The Date Picker Content Control is way cooler, it’s pops a little calendar for the user to choose a date visually. Handy!

Repeating Section
Repeating Section Appearance

…And the prize for longest prompt text goes to this control. Added to Word 2013, so it won’t work for 2007 and 2010 clients. Clicking on the plus sign in the bottom right corner duplicates the content. There are already a couple of ways to do this, so I think this is strictly for user convenience. Unlike the others, this control spans the page by default, probably because of the long prompt.

Group

No screen capture for this one, because it’s more of an operation than a control. Applying this to a selected set of Content Controls will group them together, so they can be copied as a unit. You can’t include a Rich Text control, which can also be used as a group. If you select controls, then get an error when grouping that a control is “partially covered”, it will usually be about the topmost control. Add a carriage return before, include it when you select, then run the Group macro.


Simple Controls from Keyboard shortcuts

Fortunately, the VBA object model for Word 2016 and 2019 for Mac includes Content Controls. If you’re creating forms for your own use, there is a simple way to create basic Content Controls on your Mac:

  1. In Word, choose Tools>Customize Keyboard
  2. Scroll Categories and pick All Commands
  3. Scroll Commands and pick ContentControlCheckBox
  4. Click inside the Press new keyboard shortcut field and type a key combination. Word will inform you if that combination is already in use. If there is no conflict, or an insignificant conflict, click on the Assign button. Finally, click on OK. The Control key is a good modifier, because all existing keyboard shortcuts with Control are duplicates of ones that also use the Command key.
  5. Click on your document where you would like to see a checkbox, then use the keyboard shortcut. Viola! Instant checkbox!

Repeat the steps for the other Content Control commands. It’s not a bad idea to make a sample document with Content Controls and their shortcuts, for later reference. BTW, keyboard shortcuts are the only customization that can access Content Controls. Equivalent commands for the QAT and Ribbon haven’t been added as of this writing.


Content Controls for macOS: Complex Controls for Clients

The keyboard shortcuts are fine for plain vanilla controls. But they’re so basic, some are useless. Sure you can insert a Drop-Down or Combo Box, but they don’t have any items in the list and there’s no easy way to add them. What we need is more fine-grained control so we can set all the same options that a Windows user can. This is possible by inserting them using VBA.

If you never used macros in Word, start by making the Developer tab visible on the Ribbon. Choose Word>Preferences>View and check Show developer tab. The tab becomes visible when you close the Prefs panel.

On the Developer tab, click on the Visual Basic button (Word doesn’t run Visual Basic, but a very similar language called Visual Basic for Applications. This is VBA, not VB, but why would MS care about an accurate button title?). The VBA Editor opens. In the top left corner is a windows called Projects. If you have a fresh installation, you’ll only see Normal here. If you have Add-ins installed, there will be other project names. Select Normal.

From the macOS menu, choose Insert>Module. Call it ContentControls. A new module page is opened where you can insert macro code. Copy and paste the following code onto that page:

Sub AddRichTextCC()
  Dim oCC As ContentControl
  Set oCC = ActiveDocument.ContentControls.Add(wdContentControlRichText, Selection.Range)
  Set oCC = Nothing
End Sub
Sub AddPlainTextCC() Dim oCC As ContentControl Set oCC = ActiveDocument.ContentControls.Add(wdContentControlText, Selection.Range) With oCC .MultiLine = True End With Set oCC = Nothing End Sub
Sub AddPictureCC() Dim oCC As ContentControl Set oCC = ActiveDocument.ContentControls.Add(wdContentControlPicture, Selection.Range) Set oCC = Nothing End Sub
Sub AddBuildingBlockCC() Dim oCC As ContentControl Set oCC = ActiveDocument.ContentControls.Add(wdContentControlBuildingBlockGallery, Selection.Range) With oCC .BuildingBlockType = wdTypeAutoText .BuildingBlockCategory = "General" End With Set oCC = Nothing End Sub
Sub AddCheckBoxCC()
  Dim oCC As ContentControl
  Set oCC = ActiveDocument.ContentControls.Add(wdContentControlCheckBox, Selection.Range)
  With oCC
    .Checked = False
    .SetCheckedSymbol CharacterNumber:=&HFE, Font:="Wingdings"
    .SetUncheckedSymbol CharacterNumber:=&HA8, Font:="Wingdings"
  End With
  Set oCC = Nothing
End Sub
Sub AddComboBoxCC() Dim oCC As ContentControl Set oCC = ActiveDocument.ContentControls.Add(wdContentControlComboBox, Selection.Range) With oCC .DropdownListEntries.Add "Choose an item.", value:="" .DropdownListEntries.Add "Item 1" .DropdownListEntries.Add "Item 2" End With Set oCC = Nothing End Sub
Sub AddDropDownCC() Dim oCC As ContentControl Set oCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList, Selection.Range) With oCC .DropdownListEntries.Add "Choose an item.", value:="" .DropdownListEntries.Add "Item 1" .DropdownListEntries.Add "Item 2" End With Set oCC = Nothing End Sub
Sub AddDatePickerCC()
  Dim oCC As ContentControl
  Set oCC = ActiveDocument.ContentControls.Add(wdContentControlDate, Selection.Range)
  With oCC
    .DateDisplayFormat = "MMMM d, yyyy"
    .DateDisplayLocale = wdEnglishUS
    .DateCalendarType = wdCalendarWestern
  End With
  Set oCC = Nothing
End Sub
Sub AddRepeatingSectionCC() Dim oCC As ContentControl Set oCC = ActiveDocument.ContentControls.Add(wdContentControlRepeatingSection, Selection.Range) With oCC .AllowInsertDeleteSection = True .RepeatingSectionItemTitle = "Repeating Section Item" End With Set oCC = Nothing End Sub
Sub AddGroupCC() Dim oCC As ContentControl Set oCC = ActiveDocument.ContentControls.Add(wdContentControlGroup, Selection.Range) Set oCC = Nothing End Sub

Use the Tools>Customize Keyboard command to assign these macros keyboard shortcuts. You can also add them to the Quick Access Toolbar. If you subscribe to Office 365 or have Office 2019, you can also add them to the Ribbon.

If you take a close look at the code, you’ll see there are additional lines on some that allow you to set options for that type of control. As one example, the Date Picker includes options for the calendar type, date format and date language. In use, you would alter these options to suit the client, then run the macro to add a control with those options set.


Content Controls for macOS: Setting the Options

Here’s where you can really customize the Content Controls. These are generic options that can be set for all Content Controls. Rather than bulk up each individual macro, here’s one macro to set the extra options. Set the options in code, select a Content Control that you’ve already inserted, then run the macro. If you’re inserting many controls that have a common setting, like .LockControl = True, add that line to the code for inserting the control to avoid extra steps.

Sub SetOptions()
  If Selection.Information(wdInContentControl) Then
    With Selection.ParentContentControl
      'Sets the appearance to the original bounding box look. For the newer tags look, use wdContentControlTags
      'If you don't need to change a setting, comment it out before running the macro
      .Appearance = wdContentControlBoundingBox
'Sets the color of the control to a preset color .Color = wdColorWhite
'Sets the Word Character style to use for the text formatting. This will fail if you use a Paragraph style or forget to create the style before running this. This does _not_ change the placeholder text appearance, just the entered text that replaces it. .DefaultTextStyle = "Big"
'Sets whether the Content Control can be deleted or not. If the control has had .Temporary = True applied, you must reverse that property to True before applying this. .LockContentControl = True
'Sets whether the contents of the Content Control can be deleted or not. .LockContents = False
'Sets the placeholder text or prompt for the control .SetPlaceholderText , , "Default Text"
'Sets the Content Control tag property .Tag = "Tag"
'If this is set to true, the Content Control will be removed when the contents are edited. .Temporary = False
'Sets the title of the Content Control. This appears on a tab above the control when it is activated. .Title = "Title" End With Else MsgBox "Please select a Content Control to change its options." End If End Sub

Perhaps you need to create a date picker in a different language. Starting with the macro above for U.S. English dates, you can modify it to create a French date picker:

Sub AddFrenchDatePickerCC()
  Dim oCC As ContentControl
  Set oCC = ActiveDocument.ContentControls.Add(wdContentControlDate, Selection.Range)
  With oCC
    .DateCalendarType = wdCalendarWestern
    .DateDisplayFormat = "d MMMM yyyy"
    .DateDisplayLocale = wdFrench
  End With
  Set oCC = Nothing
End Sub

Utility Macros

The following macros perform essential functions that may only be occasionally required. First, a pair to toggle all Content Controls between the older Bounding Box appearance and the newer Tags look. The only control that currently displays as a tag in macOS is the Group Content Control. All others appear as plain text in a mysterious field. As a consequence, don’t use this setting for forms to be used on a Mac. Save it for Windows clients:

Sub BoundingBoxAppearance() 'Sets all Content Controls in the document to a bounding box appearance
  Dim oCC As ContentControl
  For Each oCC In ActiveDocument.ContentControls
    oCC.Appearance = wdContentControlBoundingBox
  Next oCC
  Set oCC = Nothing
End Sub
Sub TagAppearance() 'Sets all Content Controls in the document to the tag appearance. Dim oCC As ContentControl For Each oCC In ActiveDocument.ContentControls oCC.Appearance = wdContentControlTags Next oCC Set oCC = Nothing End Sub

This macro deletes the existing list of a Combo Box or Drop-Down and replaces it with a new list.

Sub ReviseComboBoxOrDropDownList()
  If Selection.Information(wdInContentControl) Then
    If Selection.ParentContentControl.Type = wdContentControlComboBox Or Selection.ParentContentControl.Type = wdContentControlDropdownList Then
      With Selection.ParentContentControl
        .DropdownListEntries.Clear
        .DropdownListEntries.Add "Choose an item.", value:=""
        .DropdownListEntries.Add Text:="List Item 1", value:="1"
        .DropdownListEntries.Add Text:="List Item 2", value:="2"
      End With
    End If
  Else
    MsgBox "Please select a Combo Box or Drop-Down Content Control to change its list."
  End If
End Sub

Finally, one to ungroup a Group Content Control. Switch to Tag view to see Groups, they’re invisble in Bounding Box view. Don’t try to select all group items before ungrouping, it will generate an error. Instead, single-click anywhere inside the group:

Sub UnGroupCC() 'Ungroups a group control
  If Selection.Information(wdInContentControl) Then
    Selection.ParentContentControl.Ungroup
  End If
End Sub

For more in-depth reference on these macros, please see Microsoft’s documentation.

Now you’re equipped to send your client top-quality fillable forms with the latest technology. So when your client asks if you can create Content Controls, instead of saying “Huh?”, you can reply confidently “No problem!”

5:23 pm

66 thoughts on “Content Controls for macOS – Cool Code

  1. Hi John,
    I have a below code that fills content control in MS wWord using VBA.
    This code works in windows os but not in Mac OS.

    Can you help me to solve this issue ?.

    Thank you.

    With ActiveDocument
    .SelectContentControlsByTag(“Country”).Item(1).Range.Text = “USA”
    End With

    • This code is working here in both Windows and Mac:

      Sub SetText()
          Dim oCC As ContentControl
          Set oCC = ActiveDocument.SelectContentControlsByTag("Country").Item(1)
          oCC.Range.Text = "USA"
      End Sub
  2. Hi John,

    This is very helpful! I can now send “protected” forms to my students to fill out!

    One question though, how do I change the font color? I mean, obviously I can change the “click or tap here to enter text” to whatever color I want using the menu bar options but as soon as I start typing in the textbox, it switches to black by default.

    Thanks!

    • I always create and use Styles in all documents. So I create a style for the Content Control filled text. I apply that style to an ordinary empty paragraph. Then I insert the Content Control. Then when you enter text, it will appear in the style of the surrounding text.

      If you’re using local formatting (select text, use Format font to apply font color), do the formatting to the paragraph first, then insert the CC.

      When the Content Control is first inserted, the placeholder text is formatted with the PlaceholderText character style. This is based on the style into which the CC has been inserted, but with gray text. As soon as you start typing, that will be replaced by your font color.

  3. Hello John,

    Appreciate this post because it’s very helpful. I’m trying to figure out a way how to use it for populating multiple like fields (repeating data). For example, on a process document, I have a title field on separate pages. If I change one title field, the rest should change. The file I have now is set up in Windows with an XML code I followed from this website: https://gregmaxey.com/word_tip_pages/repeating_data.html. I’m using a Mac so I have no way of editing things. I’m trying to do away with that. Looking forward to your response.

    • Since you read Greg’s page, you know that there are lots of ways to make data repeat through a document. Unless the document needs to be locked down for some reason, my preferred method is to create a unique style for the title text, then use a StyleRef field in all the other places that title is to appear (#8 on Greg’s list). It works well, it’s simple and can be done with the program interface on both Windows and Mac.

      With Content Controls, Greg mentions 3 techniques: using Properties, using Simple Links and Custom Mapping. Which are you trying to implement?

      • Hi John,

        I tried the solution where you load a text document file in Windows version of Word and that takes care of the repeating data fields. I can’t seem to find it in that link, but I remember copying it from his site.

        I tried the StyleRef, but I can’t seem to make it work on the text body. It only works if I place it on a header or a footer.

  4. i just don’t get it.. I’m no coder… I’m just a desperate nurse trying to get my work done faster. I’m working on a mac. I need to be able to add a date picker in my forms. I’m welling to learn to code but I have not enough time at the moment. Please help me.. I wish I could send you a screen shot to show you where I’m at in the procedure. Can you please contact me.

    • Here’s the macro modified to create a French date picker:

      Sub AddFrenchDatePickerCC()
        Dim oCC As ContentControl
        Set oCC = ActiveDocument.ContentControls.Add(wdContentControlDate, Selection.Range)
        With oCC
          .DateCalendarType = wdCalendarWestern
          .DateDisplayFormat = "d MMMM yyyy"
          .DateDisplayLocale = wdFrench
        End With
        Set oCC = Nothing
      End Sub
  5. John, thank you. Your samples, tutorials, explanations are a godsend!

    I wondered if you might share a VBA snippet to use for the below scenario.

    A combobox box with a list or display name that, once selected by user, inputs a different text string.

    For example, if I wanted to use a combobox control to show a list of several items that each displays a different corresponding text string when selected (e.g., list item “Property” that when selected by user inputs text, “1 Main Street, City, State, Zip” into the document)?

    Any help or insight you can offer would be immensely appreciated.

    • Please be more specific. Which lines do you think are missing? Each CC code block includes only the lines that are unique to that control. For general-purpose code that applies to all controls, please see the SetOptions macro.

  6. Also, what is the code for “combobox” … I have to use VBA since the combbox feature in MAC will now allow me to add a long text string.
    Many thanks.

    • Sorry, I don’t understand what you mean. Please see the AddComboBoxCC macro for the basic macro to add that control. Perhaps instead of “now”, you mean “not”?

  7. Dear John
    I am also having a problem with drop box in word Office 365 on my Mac. I did not understand completely what should I do and when coping the files there are several boxes. Should I copy content of the first one or all?
    Ih I try to copy content from all boxes it marks also the text outside those gray boxes…
    Is there a help for me??

    Thanks! Best regards.

    • Sorry, but your description of your problem is not clear enough for me to understand. You mention copying files, then copying content. Are you trying to copy a document, a content control, or just the text of the content control?

  8. Dear John,

    Can you please kindly help me out? I’ve ran the “AddRepeatingSectionCC” to the a table row and it’s added an additional row to the bottom of the table. However, unlike the original rows, where I can ‘tab’ from one cell to another, the cells in the additional rows seem to have lost that functionality – it simply tab within the cell increasing each cell; rather than tab over to the next cell when the user fills in the form. Is there a way to fix this? The rows added do not seem to inherit the characteristics of the original row. Your guidance to resolve this will be very much appreciated. Many thanks.

    • Hi John,

      I’ve now realised that the VBA codes uses Content Controls whilst my table uses Form Fields. Is there a way to modify the code for it to work with Form Fields? Thanks very much in advance.

        • I have created a form in MS Word.
          The form consists of a table of 4 columns, which users can use to list information.
          Each of the cell in the table, contains a ‘Form Field’ so users can tab to each cell to fill in the table; but not modify the rest of the document as the form will be protected.

          I want the users to be able to add additional lines to the table if required.
          I used the “AddRepeatingSection CC” VBA which you kindly provided to create a “+” at the end of the table for users to add an additional row to the table.

          The VBA does create the “+” and by clicking the “+”, it does add an additional row to the table.
          However, the ‘tab’ function no longer works in the newly created rows – i.e. users cannot tab to go from one cell to the next cell. Tabbing is now within a cell, making each cell larger; instead of going to the next cell as in the original rows.

          I suspect this is because the table has ‘Form Field’ in each cell rather than “Content Control”. Does the “AddRepeatingSectionCC” VBA works with Form Fields? If it does not, can you let me know if there is an easy way to make it work for Form Fields?

          Many thanks in advance for your help.

          Best wishes,
          Euanne.

          • Your form might be easier to use if you use content controls with protected area exceptions, a more sophisticated type of protection that was introduced at the same time as content controls. The old form fields and section-based protection for forms makes a document inflexible by comparison. While it is possible to mix the two technologies, there’s very little technical support available for that scenario. If you’re not able to figure it out, I’m available to consult for US$30 per 15 minute time segment. You would have to email your document so I can see what you’re talking about.

  9. Thanks so much for this information!

    Once you’ve added a drop down box using this method how to do you edit it? At the moment I’m unsure how I can change what they can choose on the drop down menu.

  10. How can I create a text field that is dependent on the results from a dropdown in Word for Mac 2019? My attempts using nested IF” fields doesn’t work properly, despite precisely following the “Help” within the application.

  11. Pingback: Is it possible to create a sort of template/zone to guide others where to insert images in a Word document? - Boot Panic

  12. Hello John, I have added the macro to my mac. How do I change the drop down “word” choices. I know it says “item 1”, “item 2”. Do I need to change those words in the code? Or, is there a way to change what the drop down choices are without rewriting the code?

    Also, if I have to change it in the code, what does that do to my document if I need to use multiple drop down sections?

    Thank you,

    • To change the options that appear in the dropdown, use the macro called ReviseComboBoxOrDropDownList. Edit the code to change the Text parameter to the wording you need to see for each choice. Then select the content control in Word and run the macro. Once the dropdown choices are correct, move on to the next dropdown. Edit the macro, select the dropdown, run the macro until you have set all the dropdown lists in your document.

    • As noted in the article: “This is the only Content Control that doesn’t work yet on a Mac.”

      If you’re getting an error when creating a building block CC, please post the code you’re running and the error message that displays. Include the version of Word you’re using. You can find this in the Word>About Word dialog.

  13. Pingback: Customize existing MS Word Template document's variables & Content Controls

  14. I keep getting the following error:
    Compile error:

    User-defined type not defined.

    I am trying to create a dropdown list with a default nonselectable item that reads Select one or Choose an item.

      • Hi! Thank you for getting back to me. I copied and pasted your code.

        Sub AddRichTextCC()
        Dim oCC As ContentControl
        Set oCC = ActiveDocument.ContentControls.Add(wdContentControlRichText, Selection.Range)
        Set oCC = Nothing
        End Sub
        Sub AddCheckBoxCC()
        Dim oCC As ContentControl
        Set oCC = ActiveDocument.ContentControls.Add(wdContentControlCheckBox, Selection.Range)
        With oCC
        .Checked = False
        .SetCheckedSymbol CharacterNumber:=&HFE, Font:=”Wingdings”
        .SetUncheckedSymbol CharacterNumber:=&HA8, Font:=”Wingdings”
        End With
        Set oCC = Nothing
        End Sub

        Sub AddComboBoxCC()
        Dim oCC As ContentControl
        Set oCC = ActiveDocument.ContentControls.Add(wdContentControlComboBox, Selection.Range)
        With oCC
        .DropdownListEntries.Add “Choose an item.”, value:=””
        .DropdownListEntries.Add “Item 1”
        .DropdownListEntries.Add “Item 2”
        End With
        Set oCC = Nothing
        End Sub

        Sub AddDropDownCC()
        Dim oCC As ContentControl
        Set oCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList, Selection.Range)
        With oCC
        .DropdownListEntries.Add “Choose an item.”, value:=””
        .DropdownListEntries.Add “Item 1”
        .DropdownListEntries.Add “Item 2”
        End With
        Set oCC = Nothing
        End Sub

        Sub AddPlainTextCC()
        Dim oCC As ContentControl
        Set oCC = ActiveDocument.ContentControls.Add(wdContentControlText, Selection.Range)
        With oCC
        .MultiLine = True
        End With
        Set oCC = Nothing
        End Sub

        Sub AddPictureCC()
        Dim oCC As ContentControl
        Set oCC = ActiveDocument.ContentControls.Add(wdContentControlPicture, Selection.Range)
        Set oCC = Nothing
        End Sub

        Sub AddBuildingBlockCC()
        Dim oCC As ContentControl
        Set oCC = ActiveDocument.ContentControls.Add(wdContentControlBuildingBlockGallery, Selection.Range)
        With oCC
        .BuildingBlockType = wdTypeAutoText
        .BuildingBlockCategory = “General”
        End With
        Set oCC = Nothing
        End Sub

  15. I have added the command to add the drop down box. It works. From that point, I cannot figure out how to add choices.

    • In the article, look for the ReviseComboBoxOrDropDownList macro in the Utility Macros section. Use as many .DropdownListEntries.Add commands as you need to add all the items needed in the list.

      • Hi John…am trying to alter the list of dropdown netries and above you say “Use as make .DropdownListEntries.Add commands as you need to add all the items needed in the list.”
        Sorry…I don’t understand!

        • For each item you need to add to the dropdown, include another .DropdownListEntries.Add command:

          With oCC
              .DropdownListEntries.Add "Choose an item.", value:=""
              .DropdownListEntries.Add "Item 1"
              .DropdownListEntries.Add "Item 2"
              .DropdownListEntries.Add "Item 3"
              'Keep adding more statements, one for each dropdown list entry.
          End With

  16. Hi John! I’ve added in my document multiple checkbox content controls. I’m using Windows and my users (the one who will fill out the doc) are using Mac. When they try to tick the checkbox I’ve made, it’s shown as an object and it’s not clickable. I’ve already created a couple of templates and each template with 20+ checkboxes. What would be the best course of action to do here? Thank you!!

    • You don’t state what version of Word your Mac users are on. If it’s Word 2011 or earlier, you’ll have to create fillable forms using Legacy Formfields instead of Content Controls. Here is Microsoft’s page on creating these. Please note, this article mislabels legacy formfields as content controls. However, the steps to follow are accurate.

      • Hi John, our users are using Word version 16.71 so ideally it should work, right? I’m not sure why it shows up as an object for them.

  17. Hello,

    I want to do a drop down menu that changes the color of the word based on what option I choose. For example I want “New” to be in purple automatically after I select it from the drop down.

    Is this possible on a Mac in word?

    • Unfortunately, Content Controls lack an OnChange event, so a macro can’t run simply from making a choice in a dropdown. You have to actually exit the Content Control by tabbing or clicking elsewhere to make the VBA execute.

      A simpler solution for your case might be to create words in the colors you want to see them, then add them to AutoText. You can assign AutoText (called Building Blocks in Tools>Customize Keyboard) entries a keyboard shortcut, so you can insert a purple New by pressing something like Control + w. The Control key is a good modifier in macOS because the Command key is already loaded with existing keyboard shortcuts.

  18. Hi John –
    Thank you so much for this information! We have many staff that use Macs who couldn’t create drop downs before.

    I’ve combined this with allowing user input via pop-up windows as most of my staff isn’t tech-savy enough to edit the custom VBA to set the options in a drop down.

    As of right now, the only option I can find for making any changes to the options is to wipe them all out and have the user re-enter them with the desired changes. This is a pain for my users as our drop down lists often have MANY options (20-50) and so every small change requires them to re-enter all the options.

    I’ve been trying to find a way to allow them to “edit” the existing options with no luck. Any suggestions? Again, really appreciate your work on this.

    • Subscribers to this blog get a free copy of our MacOS Content Controls add-in. After installing this add-in, Word’s Developer tab gains the same buttons that appear in the Windows version of Word, allowing you to create and modify Content Controls without using VBA.

    • If you mean “Once we have copied a macro to the Visual Basic Editor, what is the next step?”, the answer is to run the code. You can do that using the Run command in the VBE (looks like a blue arrowhead). You can also run macros from within Word, but there are more steps: Tools>Macro>Macros, set the Macros in dropdown to the file containing the macro, select the macro, then click on Run.

  19. Hi John,

    Thank you for putting this resource together. Is there any way to code this in such a way that you could store the contents of multiple dropdown lists within the visual basic setup? I am currently creating a separate document of code for my most frequently used lists, but it seems like the only way to accomplish what I need within the word doc is to manually go into the visual basic and replace the block for each new dropdown every single time I want to edit. For instance, if I need to add to an existing dropdown list, it looks like I would have to go back to my text file and just copy that from the external program/completely rewrite the code for the ReviseComboBoxOrDropdownList function if the most recent iteration of the macro that was run was for another list. Not sure if that makes any sense. Was just wondering if there was any additional workaround for this. Thanks so much for your time.

    • This article shows how to format Content Controls, but for day-to-day use, my Content Control add-in is much more convenient. Using it, you can revise dropdown lists with the Properties dialog. At the time I write this, you can get the add-in by subscribing to this blog.

      If you prefer to edit using VBA, consider adding the controls and code to a macro-enabled Word template. Then create your new documents from that template. The code will always be available for you to edit in the template attached to the document.

  20. I am getting the following error when copying your instructions and attempting to run the macro:

    Run time error 4605
    This method or property is not available because the current selection partially covers a plain text content control.

    Any advice?

    • The error message indicates that your selection includes text outside the content control. This is confusing the VBA. Please ensure that the selection includes only the content control that you are trying to change.

  21. Thank you very much for this, which helps tremendously on my Mac. However, I keep getting errors due to differente language settings.
    E.g., I have inserted everything on a Mac with German region and date settings and German language and it worked.
    Now I wanted to use this code on a machine with English language but German region and date and it fails with an error code (Runtime error 6257; This calendar type is not available for the current date language) and it shows the line .DateCalendarType = wdCalendarWestern in yellow. It inserts the field but it shows only like 01/01/2024 disregarding the .DateDisplayFormat.

    I have not found a solution yet and hope that you might be able to help.

    Thank you!

    • Thanks for posting about this issue. We’ll try to reproduce the problem and find a fix, but unfortunately, not all of the date control methods are exposed to VBA, so there are limits to what you can program in a macro.

      • Thank you, in the meantime I have been able to solve the issue, maybe it is useful to others.
        It was the sequence in the code that you posted. Instead it needs to be in the following order:

        With oCC
        .DateDisplayFormat = “d. MMMM yyyy”
        .DateDisplayLocale = wdGerman
        .DateCalendarType = wdCalendarWestern
        End With

        Then it does not fail with the above mentioned error.

Leave a Reply

*Required fields. Your email address will not be published.

Posting XML? To enter XML code, please replace all less than signs "<" with "&lt;" and greater than signs ">" with "&gt;". Otherwise, Wordpress will strip them out and you will see only a blank area where your code would have appeared.