Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Home Page (Objects) | Overview | FAQ | Reference
Applies to: TextDocument object
Searches a document for a specified string. If the string is found, the MarkText method marks the lines containing the string with unnamed temporary bookmarks.
Syntax
object**.MarkText(string [,**flags] )
Parameters
object
An expression that evaluates to a TextDocument object.
string
A String that is the string you want to find.
flags
(Optional) A Long that determines how to conduct the search. To perform complex searches, you can combine values. The values you can use singly or in combination are:
dsMatchWord Requires that whole words match.
dsMatchCase Requires a case-sensitive match.
dsMatchPlain Does not use regular expressions (the default).
dsMatchRegExp Requires a match with Developer Studio regular expressions.
dsMatchRegExpB Requires a match with BRIEF® regular expressions.
dsMatchRegExpE Requires a match with Epsilon™ regular expressions.
dsMatchRegExpCur Requires a match using the current regular expression setting.
Return Values
The MarkText method returns one of the following values:
True If the search is successful.
False If the search is not successful.
Remarks
You can combine values in the flags parameter by using the or or + operator. For example, to conduct a case-sensitive forward search, you could specify dsMatchForward or dsMatchCase or dsMatchForward + dsMatchCase. However, you can use only one of the regular expression values at a time. For example, you cannot combine dsMatchRegExpCur with dsMatchRegExpE.
You can move from bookmark to bookmark in a document. First, press CTRL+F2 so that you can move forward or backward. Then, press F2 to move forward, or press SHIFT+F2 to move backward.
Example
The following example conducts a case-sensitive search of the current selection to find the text "TODO" and then marks the lines containing this text with unnamed temporary bookmarks:
Sub MarkMain
ActiveDocument.Selection.MarkText "TODO", dsMatchCase
End Sub
See Also FindText method, ReplaceText method.