ID: Q89653
The information in this article applies to:
In 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 annotations
To 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 Sub
If you are using Word version 2.x for Windows, change the EditFind
statement in the above macro to the following:
EditFind .Find = "^2", .Direction = 2
The 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 Sub
If 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
ARTICLE-ID: Q158854
TITLE : WD97: Compile Error If VB Code Doesn't Find Comments
"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 viewannotations viewfootnotes macword winword
Keywords : wordnt kbmacroexample winword ntword 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 : kbhowto kbinfo
Last Reviewed: February 4, 1998