Find Method

Microsoft FrontPage Visual Basic

expression.Find(info, limits, startRange)

expression    Required. An expression that returns one of the objects in the Applies To list.

info Required SearchInfo. The SearchInfo object that contains the search information.

limits Optional Variant. Specifies an IHTMLTxtRange object that represents the range of text on which to perform the search. If omitted, search is performed on the entire document from the specified starting point.

startRange Optional Variant. Specifies an IHTMLTxtRange object that represents the position in the document from which to start the search. If omitted, search starts at the beginning of the document.

Remarks

If the Action property is set to fpSearchFindText or fpSearchReplace text, the Find property defines the text for which to search; if the Action property is set to fpSearchFindTag, then the Find property defines the name of the HTML tag for which to search.

Example

The following example selects the next occurence of the P element if one is found in the active document.

Dim objSearch As SearchInfo
Dim blnFound As Boolean
Dim objRange As IHTMLTxtRange

Set objSearch = Application.CreateSearchInfo
objSearch.Find = "p"
objSearch.Action = fpSearchFindTag

Set objRange = Application.ActiveDocument.selection.createRange
blnFound = Application.ActiveDocument.Find(objSearch, Nothing, objRange)
If blnFound = True Then objRange.Select