Find.Execute2007 Method

Runs the specified find operation. Returns True if the find operation is successful.

Namespace:  Microsoft.Office.Interop.Word
Assembly:  Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)

Syntax

'Declaration
Function Execute2007 ( _
    ByRef FindText As Object, _
    ByRef MatchCase As Object, _
    ByRef MatchWholeWord As Object, _
    ByRef MatchWildcards As Object, _
    ByRef MatchSoundsLike As Object, _
    ByRef MatchAllWordForms As Object, _
    ByRef Forward As Object, _
    ByRef Wrap As Object, _
    ByRef Format As Object, _
    ByRef ReplaceWith As Object, _
    ByRef Replace As Object, _
    ByRef MatchKashida As Object, _
    ByRef MatchDiacritics As Object, _
    ByRef MatchAlefHamza As Object, _
    ByRef MatchControl As Object, _
    ByRef MatchPrefix As Object, _
    ByRef MatchSuffix As Object, _
    ByRef MatchPhrase As Object, _
    ByRef IgnoreSpace As Object, _
    ByRef IgnorePunct As Object _
) As Boolean
'Usage
Dim instance As Find
Dim FindText As Object
Dim MatchCase As Object
Dim MatchWholeWord As Object
Dim MatchWildcards As Object
Dim MatchSoundsLike As Object
Dim MatchAllWordForms As Object
Dim Forward As Object
Dim Wrap As Object
Dim Format As Object
Dim ReplaceWith As Object
Dim Replace As Object
Dim MatchKashida As Object
Dim MatchDiacritics As Object
Dim MatchAlefHamza As Object
Dim MatchControl As Object
Dim MatchPrefix As Object
Dim MatchSuffix As Object
Dim MatchPhrase As Object
Dim IgnoreSpace As Object
Dim IgnorePunct As Object
Dim returnValue As Boolean

returnValue = instance.Execute2007(FindText, _
    MatchCase, MatchWholeWord, MatchWildcards, _
    MatchSoundsLike, MatchAllWordForms, _
    Forward, Wrap, Format, ReplaceWith, _
    Replace, MatchKashida, MatchDiacritics, _
    MatchAlefHamza, MatchControl, MatchPrefix, _
    MatchSuffix, MatchPhrase, IgnoreSpace, _
    IgnorePunct)
bool Execute2007(
    ref Object FindText,
    ref Object MatchCase,
    ref Object MatchWholeWord,
    ref Object MatchWildcards,
    ref Object MatchSoundsLike,
    ref Object MatchAllWordForms,
    ref Object Forward,
    ref Object Wrap,
    ref Object Format,
    ref Object ReplaceWith,
    ref Object Replace,
    ref Object MatchKashida,
    ref Object MatchDiacritics,
    ref Object MatchAlefHamza,
    ref Object MatchControl,
    ref Object MatchPrefix,
    ref Object MatchSuffix,
    ref Object MatchPhrase,
    ref Object IgnoreSpace,
    ref Object IgnorePunct
)

Parameters

  • FindText
    Type: System.Object%
    The text to be searched for. Use an empty string ("") to search for formatting only. You can search for special characters by specifying appropriate character codes. For example, "^p" corresponds to a paragraph mark and "^t" corresponds to a tab character.
  • MatchCase
    Type: System.Object%
    True to specify that the find text be case sensitive. Corresponds to the Match case check box in the Find and Replace dialog box (Edit menu).
  • MatchWholeWord
    Type: System.Object%
    True to have the find operation locate only entire words, not text that is part of a larger word. Corresponds to the Find whole words only check box in the Find and Replace dialog box.
  • MatchWildcards
    Type: System.Object%
    True to have the find text be a special search operator. Corresponds to the Use wildcards check box in the Find and Replace dialog box.
  • MatchSoundsLike
    Type: System.Object%
    True to have the find operation locate words that sound similar to the find text. Corresponds to the Sounds like check box in the Find and Replace dialog box.
  • MatchAllWordForms
    Type: System.Object%
    True to have the find operation locate all forms of the find text (for example, "sit" locates "sitting" and "sat"). Corresponds to the Find all word forms check box in the Find and Replace dialog box.
  • Forward
    Type: System.Object%
    True to search forward (toward the end of the document).
  • Wrap
    Type: System.Object%
    Controls what happens if the search begins at a point other than the beginning of the document and the end of the document is reached (or vice versa if Forward is set to False). This argument also controls what happens if there is a selection or range and the search text is not found in the selection or range. Can be one of the WdFindWrap enumeration values.
  • Format
    Type: System.Object%
    True to have the find operation locate formatting in addition to, or instead of, the find text.
  • ReplaceWith
    Type: System.Object%
    The replacement text. To delete the text specified by the Find argument, use an empty string (""). You specify special characters and advanced search criteria just as you do for the Find argument. To specify a graphic object or other nontext item as the replacement, move the item to the Clipboard and specify "^c" for ReplaceWith.
  • Replace
    Type: System.Object%
    Specifies how many replacements are to be made: one, all, or none. Can be any WdReplace enumeration value.
  • MatchKashida
    Type: System.Object%
    True if find operations match text with matching kashidas in an Arabic-language document. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
  • MatchDiacritics
    Type: System.Object%
    True if find operations match text with matching diacritics in a right-to-left language document. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
  • MatchAlefHamza
    Type: System.Object%
    True if find operations match text with matching alef hamzas in an Arabic-language document. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
  • MatchControl
    Type: System.Object%
    True if find operations match text with matching bidirectional control characters in a right-to-left language document. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
  • MatchPrefix
    Type: System.Object%
    True to match words beginning with the search string. Corresponds to the Match prefix check box in the Find and Replace dialog box.
  • MatchSuffix
    Type: System.Object%
    True to match words ending with the search string. Corresponds to the Match suffix check box in the Find and Replace dialog box.
  • MatchPhrase
    Type: System.Object%
    True ignores all white space and control characters between words.
  • IgnoreSpace
    Type: System.Object%
    True ignores all white space between words. Corresponds to the Ignore white-space characters check box in the Find and Replace dialog box.
  • IgnorePunct
    Type: System.Object%
    True ignores all punctuation characters between words. Corresponds to the Ignore punctuation check box in the Find and Replace dialog box.

Return Value

Type: System.Boolean
A Boolean value indicating whether the find operation was successful.

Remarks

If MatchWildcards is True, you can specify wildcard characters and other advanced search criteria for the FindText argument. For example, "*(ing)" finds any word that ends in "ing".

To search for a symbol character, type a caret (^), a zero (0), and then the symbol's character code. For example, "^0151" corresponds to an em dash (—).

Unless otherwise specified, replacement text inherits the formatting of the text it replaces in the document. For example, if you replace the string "abc" with "xyz", occurrences of "abc" with bold formatting are replaced with the string "xyz" with bold formatting.

Also, if MatchCase is False, occurrences of the search text that are uppercase will be replaced with an uppercase version of the replacement text, regardless of the case of the replacement text. Using the previous example, occurrences of "ABC" are replaced with "XYZ".

See Also

Reference

Find Interface

Find Members

Microsoft.Office.Interop.Word Namespace