Share via

Making Activex drop downs mandatory

Anonymous
2016-05-20T08:28:59+00:00

I have resolved this issue now (by adding a new module, copying the below code for each field - just changing the Sub MustFillIn() to MustFillIn1, etc

How do i make drop down boxes mandatory? As i use the ActiveX combobox i do not have the ability to assign a macro

I have a large form on Word 2010 that use VBA for a variety of things like drop downs and text boxes.

A lot of these fields i would like to make mandatory. The code i found works for 1 field which is great, however i cannot add another mandatory field:

Sub MustFillIn()

    If ActiveDocument.FormFields("ReferringSchool").Result = "" Then

        Do

            sInFld = InputBox("Please provide the name of the referring school")

        Loop While sInFld = ""

        ActiveDocument.FormFields("ReferringSchool").Result = sInFld

    End If

End Sub

I managed to edit the code but then it decided to check all the mandatory fields everytime.

Any advice?

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Paul Edstein 82,861 Reputation points Volunteer Moderator
2016-05-20T09:44:04+00:00

That code appears to come from: http://word.tips.net/T001567_Using_Mandatory_Form_Fields.html

More flexible code is available at: http://www.gmayor.com/formfieldmacros.htm

I note that you have now edited your post to say:

As i use the ActiveX combobox i do not have the ability to assign a macro

but, in fact, any ActiveX control can have a macro attached. In both cases the links above point to code for formfields - not ActiveX controls.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful