Applies to |
|---|
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office. Project type Microsoft Office version For more information, see Features Available by Application and Project Type. |
There are two ways to set search options for selections in Microsoft Office Word documents:
Using Properties of a Find Object
The following code sets properties of a Find object to search for text within the current selection. Notice that the search criteria, such as searching forward, wrapping, and text to search for, are properties of the Find object.
Setting each of the properties of the Find object is not useful when you write C# code because you must specify the same properties as parameters in the Execute method. Therefore this example contains only Visual Basic code.
To set search options using a Find object
Using Execute Method Arguments
The following code uses the Execute method of a Find object to search for text within the current selection. Notice that the search criteria, such as searching forward, wrapping, and text to search for, are passed as parameters of the Execute method.
To set search options using Execute method arguments
Tasks