Guitarmageddon
Board Regular
- Joined
- Dec 22, 2014
- Messages
- 161
So I have a two-page form created by a user to get field locations to send up some information. there are about 30 or so text fields that the owner of this form wants to be mandatory to enter.
I came across this macro, which works for LEGACY form fields and not current content control text fields.
This works, but the presentation of the popup is pretty annoying and clunky. I'd also have to duplicate something like 30 modules to get this to run. There has to be a better way?
Can I have some VBA to scan ANY of the "activeDocument.FormFields" for blanks and then remind the user to enter before they are allowed to save or close the file? Seems way easier than crafting a bespoke module for every specific form field name. I would greatly appreciate the help.
I came across this macro, which works for LEGACY form fields and not current content control text fields.
VBA Code:
Sub MustFillIn()
If ActiveDocument.FormFields("MyRequiredField").Result = "" Then
Do
sInFld = InputBox("Required Installation is required, please fill in below.")
Loop While sInFld = ""
ActiveDocument.FormFields("MyRequiredField").Result = sInFld
End If
End Sub
This works, but the presentation of the popup is pretty annoying and clunky. I'd also have to duplicate something like 30 modules to get this to run. There has to be a better way?
Can I have some VBA to scan ANY of the "activeDocument.FormFields" for blanks and then remind the user to enter before they are allowed to save or close the file? Seems way easier than crafting a bespoke module for every specific form field name. I would greatly appreciate the help.