Microsoft KB Archive/140867

{|
 * width="100%"|

WD: Can't Search All Using Macro with Find or Replace Command

 * }

Q140867

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
 * Microsoft Word for Windows, versions 7.0, 7.0a
 * Microsoft Word for the Macintosh, versions 6.0, 6.0.1

-

SYMPTOMS
When you create a WordBasic macro to find or replace text (the equivalent of clicking Find or Replace on the Edit menu), you cannot specify a Direction argument to search the entire document.

CAUSE
The Direction argument only allows you to search up, search down, or wrap through the body of a document. This functionality is different from the Find and Replace dialog boxes, available on the Edit menu. These dialog boxes allow you to find or replace text throughout the entire document, including headers, footers, and text boxes.

WORKAROUND
The follow sample macro opens the Find dialog box so that you can manually select All, under Search.

WARNING: ANY USE BY YOU OF THE MACRO CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

  Sub MAIN Dim Dlg as EditFind GetCurValues dlg Dlg.Find = "SearchString" n = Dialog Dlg End Sub

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.