WD: WordBasic Macros to Test for Annotations and FootnotesLast reviewed: February 2, 1998Article ID: Q89653 |
The information in this article applies to:
SYMPTOMSIn Microsoft Word, the ViewFootnotes and ViewAnnotations macro commands will return the following error messages if there are no annotations or footnotes in the active document:
Word found no footnotes Word found no annotationsTo avoid the above error messages you can test for the presence of footnotes or annotations in a document before using the ViewFootnotes or ViewAnnotations commands. WARNING: ANY USE BY YOU OF THE 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. The following Word macro will test for the presence of automatic footnotes in your document: Note: This macro will not work with Word version 6.0 for the Macintosh. The CommandValid()function does not work with the ViewFootnotes command. The macro does work with Word version 6.0.1 for the Macintosh.
Sub MAIN n = CommandValid("ViewFootnotes") If n <> - 1 Then MsgBox "There are no footnotes in this document." Else StartOfDocument EditFind .Find = "^f", .Direction = 0 If EditFindFound() Then MsgBox "There are footnotes in this document" Else MsgBox "There are no footnotes in this document." End If End If End SubIf you are using Word version 2.x for Windows, change the EditFind statement in the above macro to the following:
EditFind .Find = "^2", .Direction = 2The following Word macro will test for the presence of annotations in your document:
Sub MAIN n = CommandValid("ViewAnnotations") If n <> - 1 Then MsgBox "There are no annotations in this document." Else StartOfDocument EditFind .Find = "^a", .Direction = 0 If EditFindFound() Then MsgBox "There are annotations in this document" Else MsgBox "There are no annotations in this document." End If End If End SubIf you are using Word version 2.x for Windows, change the EditFind statement in the above macro to the following:
EditFind .Find = "^5", .Direction = 2 MORE INFORMATION
Macro Notes
ARTICLE-ID: Q158854 TITLE : WD97: Compile Error If VB Code Doesn't Find Comments REFERENCES"Using WordBasic," by WexTech Systems and Microsoft, page 325 and 327 "Microsoft Word for Windows User's Guide," version 2.0, pages 265-266
|
Additional query words: winword2 word95 word7 word6 errmsg err msg
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |