IncludeFieldCodes Property

Applies To

TextRetrievalMode object.

Description

True if the text retrieved from the specified range includes field codes. Read/write Boolean.

Note The default value is the same as the setting of the Field codes option on the View tab in the Options dialog box (Tools menu) until this property has been set. Use the Text property with a Range object to retrieve text from the specified range.

See Also

IncludeHiddenText property, ShowCodes property, ShowFieldCodes property, Text property, TextRetrievalMode object.

Example

This example displays the text of the first paragraph in the active document in a message box. The example uses the IncludeFieldCodes property to exclude field codes.

Set myRange = ActiveDocument.Paragraphs(1).Range
myRange.TextRetrievalMode.IncludeFieldCodes = False
MsgBox myRange.Text
This example excludes fields codes and hidden text from the range that refers to the selected text, and then it displays the text in a message box.

If Selection.Type = wdSelectionNormal Then
    Set myRange = Selection.Range
    With myRange.TextRetrievalMode
        .IncludeHiddenText = False
        .IncludeFieldCodes = False
    End With
    MsgBox myRange.Text
End If