该属性返回 TextRetrievalMode 对象,该对象控制从指定区域检索文字的方式。可读写。
本示例检索选定文字(排除隐藏文字),并将其插入活动文档第三段的开始处。
If Selection.Type = wdSelectionNormal Then
Set Range1 = Selection.Range
Range1.TextRetrievalMode.IncludeHiddenText = False
Set Range2 = ActiveDocument.Paragraphs(2).Range
Range2.InsertAfter Range1.Text
End If
本示例在大纲视图中检索前三个段落。
Set myRange = ActiveDocument.Range(Start:=ActiveDocument _
.Paragraphs(1).Range.Start, _
End:=ActiveDocument.Paragraphs(3).Range.End)
myRange.TextRetrievalMode.ViewType = wdOutlineView
MsgBox myRange.Text
本示例先排除引用选定文字的区域中的域代码和隐藏文字,然后在一个消息框中显示文字。
If Selection.Type = wdSelectionNormal Then
Set aRange = Selection.Range
With aRange.TextRetrievalMode
.IncludeHiddenText = False
.IncludeFieldCodes = False
End With
MsgBox aRange.Text
End If