Table of contents
TOC
折叠目录
展开目录

FindReplace.FindText 属性 (发布服务器)FindReplace.FindText Property (Publisher)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

设置或检索一个字符串表示文本在指定的区域或所选内容中查找。读/写。Sets or retrieves a String representing the text to find in the specified range or selection. Read/write.

语法Syntax

表达式FindTextexpression. FindText

_expression_A 表示FindReplace对象的变量。_expression_A variable that represents a FindReplace object.

返回值Return Value

StringString

注解Remarks

FindText属性返回选定内容的格式文本。当设置此属性时,需要指定搜索文字。您可以通过指定相应的字符代码搜索特殊字符。例如,"^ p"对应于一个段落标记和"^ t"对应于一个制表符。The FindText property returns the plain, unformatted text of the selection. When you set this property, the search text is specified. You can search for special characters by specifying appropriate character codes. For example, "^p" corresponds to a paragraph mark and "^t" corresponds to a tab character.

FindText属性的默认值为空字符串。因为支持仅有的文本搜索,则FindText必须显式设置以避免运行时错误。The default value for the FindText property is an empty string. Because only text searching is supported, FindText must be explicitly set to avoid a runtime error.

示例Example

以下示例在每个打开的出版物中将所选内容中所有出现的单词“This”都替换为“That”。This example replaces all occurrences of the word "This" in the selection with "That" in each open publication.

Dim objDocument As Document 

For Each objDocument In Documents 
 With objDocument.Find 
 .Clear 
 .MatchCase = True 
 .FindText = "This" 
 .ReplaceWithText = "That" 
 .ReplaceScope = pbReplaceScopeAll 
 .Forward = True 
 .Execute 
 End With 
Next objDocument 
© 2018 Microsoft