The Find method finds specified text in a standard module or class module.
Syntax
object.Find(target, startline, startcolumn, endline, endcolumn[, wholeword, matchcase, patternsearch])
The Find method has the following arguments.
Argument | Description |
---|---|
object | A Module object. |
target | A string expression that evaluates to the text that you want to find. |
startline | A Long value that specifies the line on which to begin searching. If a match is found, the value of the startline argument is set to the line on which the beginning character of the matching text is found. |
startcolumn | A Long value that specifies the column on which to begin searching. Each character in a line is in a separate column, beginning with zero on the left side of the module. If a match is found, the value of the startcolumn argument is set to the column on which the beginning character of the matching text is found. |
endline | A Long value that specifies the line on which to stop searching. If a match is found, the value of the endline argument is set to the line on which the ending character of the matching text is found. |
endcolumn | A Long value that specifies the column on which to stop searching. If a match is found, the value of the endcolumn argument is set to the column on which the beginning character of the matching text is found. |
wholeword | Optional. A Boolean value where True (–1) results in a search for whole words only and False (0) results in a search for portions of words. The default is False. |
matchcase | Optional. A Boolean value where True results in a search for words with case matching the target argument and False results in a search for words regardless of case. The default is False. |
patternsearch | Optional. A Boolean value where True results in a search in which the target argument may contain wildcard characters such as an asterisk (*) or a question mark (?), and False results in a search without considering question marks or asterisks as wildcard characters. The default is False. |
Remarks
The Find method searches for the specified text string in a Module object. If the string is found, the Find method returns True; otherwise it returns False.
To determine the position in the module at which the search text was found, pass empty variables to the Find method for the startline, startcolumn, endline, and endcolumn arguments. If a match is found, these arguments will contain the line number and column position at which the search text begins (startline, startcolumn) and ends (endline, endcolumn).
For example, if the search text is found on line 5, begins on column 10, and ends at column 20, the values of these arguments will be: startline = 5, startcolumn = 10, endline = 5, endcolumn = 20.