View Single Post
 
Old 05-15-2024, 11:43 AM
gmaxey gmaxey is offline Windows 10 Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

By fields, I will assume you mean formfields. Formfield dropdowns by design can't be empty. They have to contain one of the list items that you define.



E.g., you might define "Choose Letter" as the first entry then A, B, C, D etc.


Sub ValidateFFs()
Dim oFF As FormField
For Each oFF In ActiveDocument.FormFields
Select Case oFF.Name
Case "Dropdown1"
If oFF.Result = "Choose Letter" Then
oFF.Range.Select
MsgBox "This field must have a valid selection"
Exit For
End If
Case "Text1"
'Your code for validating the Text1 field.

End Select
Next oFF
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote