I am trying to put some data checking into a word document to check for a formfield value, and if the formfield is empty, but only on document close
with the warning I need it to prompt the user, and to not allow closure of the document until this field is filled in.
I have the code to do the check, and to give the warning message, but don't know how to stop closing the document.
Here's what I have:
[vba]Private Sub Document_Close()
With ActiveDocument
If .FormFields("chkMale").CheckBox.Value = False And _
.FormFields("chkFemale").CheckBox.Value = False Then
MsgBox "Please say what gender this person is", vbInformation, "~Missing Info~"
Exit Sub 'I thought this would do it, but obviously not
Else
MsgBox "'Tis Fine!",vbinformation,"Title"
End If
End With
End Sub[/vba]