Find Method

Applies To

CodeModule object.

Description

Searches the active module for a specified string.

Syntax

object.Find(target, startline, startcol, endline, endcol [, wholeword] [, matchcase] [, patternsearch])
úAs Boolean

The Find syntax has these parts.

Part

Description

object

Required. An object expression that evaluates to an object in the Applies To list.

target

Required. A String containing the text or pattern you want to find.

startline

Required. A Long specifying the line at which you want to start the search; will be set to the line of the match if one is found.

startcol

Required. A Long specifying the column at which you want to start the search; will be set to the column containing the match if one is found.

endline

Required. A Long specifying the last line of the match if one is found.

endcol

Required. A Long specifying the last line of the match if one is found.


(continued)

Part

Description

wholeword

Optional. A Boolean value specifying whether to only match whole words. If True, only matches whole words. False is the default.

matchcase

Optional. A Boolean value specifying whether to match case. If True, the search is case sensitive. False is the default.

patternsearch

Optional. A Boolean value specifying whether or not the target string is a regular expression pattern. If True, the target string is a regular expression pattern. False is the default.


Remarks

Find returns True if a match is found and False if a match isn't found.

The matchcase and patternsearch arguments are mutually exclusive; if both arguments are passed as True, an error occurs.

The content of the Find dialog box isn't affected by the Find method.

See Also

CodePane object, GetSelection method, Lines method, ProcBodyLine method, ProcCountLines method, ProcOfLine method, ProcStartLine method.

Example

The following example uses the Find method to verify that the specified block of lines, lines 1261 through 1279, of a particular code pane does contain the string "Tabs.Clear."

Application.VBE.CodePanes(2).CodeModule.Find ("Tabs.Clear", 1261, _
    1, 1280, 1, False, False)