Hidden Property Example

This example inserts text and formats the password number as hidden text.

Selection.Collapse Direction:=wdCollapseEnd
With Selection.Range
    .InsertAfter "Smith account password: 8116"
    .Words(5).Font.Hidden = True
End With

This example checks the selection for hidden text.

If Selection.Type = wdSelectionNormal Then
    If Selection.Font.Hidden = wdUndefined or _
            Selection.Font.Hidden = True Then
        MsgBox "There's hidden text in the selection."
    Else
        MsgBox "No hidden text in the selection."
    End If
Else
    MsgBox "You need to select some text."
End If

This example makes all hidden text in the active window visible and then formats the selection as hidden text.

ActiveDocument.ActiveWindow.View.ShowHiddenText = True
If Selection.Type = wdSelectionNormal Then _
    Selection.Font.Hidden = True