A CheckBox named CheckBox1.
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
ComboBox1.MatchRequired = True
MsgBox "To move the focus from the ComboBox, you must match an entry in the list or press ESC."
Else
ComboBox1.MatchRequired = False
MsgBox " To move the focus from the ComboBox, just tab to or click another control. Matching is optional."
End If
End Sub
Private Sub ComboBox1_Change()
If ComboBox1.MatchRequired = True Then
'MSForms handles this case automatically
Else
If ComboBox1.MatchFound = True Then
MsgBox "Match Found; matching optional."
Else
MsgBox "Match not Found; matching optional."
End If
End If
End Sub
Private Sub UserForm_Initialize()
Dim i As Integer
For i = 1 To 9
ComboBox1.AddItem "Choice " & i
Next i
ComboBox1.AddItem "Chocoholic"
CheckBox1.Caption = "MatchRequired"
CheckBox1.Value = True
End Sub