Share via


IncludeFieldCodes Property

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.

expression.IncludeFieldCodes

expression Required. An expression that returns a 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.

Dim rngTemp As Range

Set rngTemp = ActiveDocument.Paragraphs(1).Range

rngTemp.TextRetrievalMode.IncludeFieldCodes = False
MsgBox rngTemp.Text

This example excludes field codes and hidden text from the range that refers to the selected text, and then it displays the text in a message box.

Dim rngTemp As Range

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

Applies to | TextRetrievalMode Object

See Also | IncludeHiddenText Property | ShowCodes Property | ShowFieldCodes Property | Text Property | TextRetrievalMode Object