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

ID: Q140867

The information in this article applies to:

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.

REFERENCES

"Microsoft Word Developer's Kit," (part number WB51159-1093), version 6.0, pages 390-393.

Additional query words: word basic wordbasic

Keywords          : kbmacro wordnt winword macword word6 word7 word95 
Version           : WINDOWS:2.0,2.0a,2.0a-CD,2.0b,2.0c,6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:6.0,6.0.1,6.0.6.0.1a
Platform          : MACINTOSH Win95 WINDOWS winnt
Issue type        : kbprb

Last Reviewed: January 21, 1999