FindReplace.FindText property (Publisher)
Sets or retrieves a String representing the text to find in the specified range or selection. Read/write.
Syntax
expression.FindText
expression A variable that represents a FindReplace object.
Return value
String
Remarks
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.
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 run-time error.
Example
This example replaces all occurrences of the word This in the selection with the word 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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for