Valid Property Example

This example determines whether the first form field in the active document is a text form field. If the Valid property is True, the contents of the text form field are changed to "Hello."

If ActiveDocument.FormFields(1).TextInput.Valid = True Then
    ActiveDocument.FormFields(1).Result = "Hello"
End If

This example adds a text form field at the insertion point. Because myFormField isn't a valid check box form field, the message box displays "False."

Selection.Collapse Direction:=wdCollapseStart
Set myFormField = ActiveDocument.FormFields.Add(Range:= _
    Selection.Range, Type:=wdFieldFormTextInput)
MsgBox myFormField.CheckBox.Valid

If the settings for the custom label named "My Labels" are valid, this example creates a new document of labels using the My Labels settings.

addr = "James Allard" & vbCr & "123 Main St." & vbCr _
    & "Seattle, WA  98040"
If Application.MailingLabel.CustomLabels("My Labels") _
        .Valid = True Then
    Application.MailingLabel.CreateNewDocument _
        Name:="My Labels", Address:=addr
End If