Others

Require an Option Button Selection in a Word VBA UserForm

Algirdas JasaitisAlgirdas Jasaitis Nov 20, 2026 869 views

Question details

Require a user to select a classification level in a Word VBA UserForm before continuing.

Require an Option Button Selection in a Word VBA UserForm
Product
Microsoft Word VBA UserForm
Device & OS
not provided
Scenario
A UserForm validates text boxes and also needs to check a group of classification option buttons.
Observed behavior
The form should display a message and stop validation when no classification option is selected.
Before you start

Open the document in Word and press Alt+F11 to locate the UserForm and its continue or submit button. Check the names of the classification option buttons in the Properties window.

Solution 1Recommended

Validate the classification option buttons before continuing

Use this check in the button's Click event to prevent the form from continuing until a classification is selected.

Option buttons in a group normally have True or False values. Test all buttons in the classification group because unselected buttons remain False even when another button is selected.

1
Check the option button group

In the VBA editor, open the UserForm and select each classification OptionButton. Use a shared Frame or GroupName to keep the classification choices together, separate from other option button groups.

2
Open the button's code

Double-click the form's continue or submit button to open its Click event. Locate the point after any text box checks and before the code that processes or closes the form.

3
Add the selection check

Insert this code inside the Click event, replacing the three example names with your classification OptionButton names and adding any other buttons in the group: If Not (Me.optPublic.Value Or Me.optInternal.Value Or Me.optConfidential.Value) Then MsgBox "Please select a classification level.", vbExclamation Me.optPublic.SetFocus Exit Sub End If

4
Test the form

Run the UserForm from the VBA editor. Click the continue button with no classification selected and confirm that the message appears; then select a classification and click the button again.

Keep the check inside the event procedure: Exit Sub stops the current Click event. Place the check before any code that should run only after validation succeeds.
Free Microsoft Office alternative

Edit Word documents with WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with Word documents. Its format compatibility makes it easy to move everyday documents between Office applications. Word VBA UserForm behavior and macro compatibility may differ, so test any macro-dependent workflow separately.

Open and edit Microsoft Word DOC and DOCX filesUse a familiar document-editing interfaceWork with classification text and other document contentMove everyday documents between WPS Office and Microsoft Office
microsoft office alternative - wps office

Frequently Asked Questions

Why can't I check just one option button?

A single option button is False whenever another choice is selected. Check every button in the classification group with Or to determine whether at least one is True.

How do I stop the form from continuing when nothing is selected?

In the continue or submit button's Click event, show a MsgBox when all classification buttons are False, then use Exit Sub before the remaining processing code.

Can I use a ComboBox instead of option buttons?

Yes. In the button's Click event, check whether Me.ComboBox1.ListIndex = -1. If it is, display a message, call Me.ComboBox1.SetFocus, and use Exit Sub.

How do I keep classification buttons separate from other choices?

In the UserForm designer, place the classification OptionButtons in their own Frame or assign them a shared GroupName that is different from other groups.