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

Last reviewed: February 5, 1998
Article ID: Q140867
The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows 95, 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.

REFERENCES

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


Additional query words: word basic wordbasic
Keywords : macword winword word6 word7 word95 wordnt kbmacro
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
Solution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 5, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.