Radio buttons in Microsoft Word for Mac 2011

7,210

The problem is that the radio buttons in Windows Word are ActiveX controls that do not exist on Mac Word.

There are radio buttons in the HTML FOrms feature on Mac Word (see the Insert->HTML Object menu) but I don't know enough about them to help, recommend, or recommend you to stay clear of them.

Possibly the easiest way to get radio buttons on Mac would be to construct your form using a VBA Userform instead of an "Online Form" in the surface of the document.

In the past I have tried to make checkboxes work more like radio buttons, by using the Exit macro to check the state and modify all the boxes in a "group". But the problem is that when you click a checkbox, the exit macro is not necessarily called, so you get a situation where more than one checkbox in a "group" can be checked, i.e. they are not radio buttons.

The only way I have managed to do it is to use MACROBUTTON fields some bookmarks, and a piece of VBA. The buttons do not appear as normal form fields so the user has to click them rather than tabe to them (or double-click, depending on their settings). I haven't used this in a real-world project, i.e. it's an experiment.

How it works.

As an experiment, insert some text form fields in a document.

For each radio button, insert a field like this:

{ MACROBUTTON radiopush O}

or this, to represent a "pushed" button

{ MACROBUTTON radiopull X}

(Use cmd-F9/fn-cmd-F9 to insert the { })

Make sure there is no space before the "}"

I actually use the Wingdings 2 character 153 instead of the "O" and Wingdings 2 character 158 instead of the "X".

Also insert the following fields:

{ SET pulled "MACROBUTTON radiopush O" }{ SET pushed "MACROBUTTON radiopull X" }

where O and X are the same characters as you use in the MACROBUTTON fields.

Select each macrobutton field in turn, and insert a bookmark. Use the first 4 characters of the bookmark name to identify a "Group", then use the rest of the name to identify the button uniquely - e.g. if you have two independent sets of 3 radio buttons, you might call them

grp1btn1
grp1btn2
grp1btn3
grp2btn1
grp2btn2
grp2btn3

Select all the fields and update them via F9/fn-F9.

Then put the following VBA in a suitable place (e.g. the .dotm that the forms are attached to or make the form a .docm and put the VBA in there).

Sub radiopull()
'MsgBox "pull"
End Sub

Sub radiopush()
'MsgBox "push"
ActiveDocument.Unprotect
strGroup = Left(Selection.Bookmarks(1).Name, 4)
For Each bm In ActiveDocument.Bookmarks
  If Left(bm.Name, 4) = strGroup Then
    If bm.Name = Selection.Bookmarks(1).Name Then
      bm.Range.Fields(1).Code.FormattedText = ActiveDocument.Bookmarks("pushed").Range.FormattedText
     Else
       bm.Range.Fields(1).Code.FormattedText = ActiveDocument.Bookmarks("pulled").Range.FormattedText
    End If
    bm.Range.Fields(1).Update
  End If
Next
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, noreset:=True
End Sub

Then protect the form and try clicking (you may need to double-click) the buttons.

If you start with only the "O" buttons, you can have an initial state where no button is pressed, but once one button is pressed, one should always be pressed.

Share:
7,210

Related videos on Youtube

Ken
Author by

Ken

Updated on September 18, 2022

Comments

  • Ken
    Ken over 1 year

    Is it possible to use radio buttons in Microsoft Word for Mac 2011? I am working on a form that requires "either" "or" answers. Therefore, the checkbox won't suffice. I know that they are available on Windows, but cannot find the option on the Mac version.