IncludeFieldCodes Property 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