Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

You receive an error message or an incorrect count of open documents when you run a VBA macro in Office 2003


View products that this article applies to.

Symptoms

When you run a Microsoft Visual Basic for Applications (VBA) macro in a Microsoft Office 2003 program, you may receive a "command not available" error message or the VBA macro may return an incorrect count of open documents.

For example, this problem may occur when you type one of the following in the Immediate window of the Visual Basic Editor:
?ActiveDocument.Permission.Count
?Application.Documents.Count
If you type ?ActiveDocument.Permission.Count, and then press ENTER, you may receive the following error message:
Run-time error 4248: The command is not available because no document is open.
Alternatively, if you type ?Application.Documents.Count, and then press ENTER, you may receive an incorrect count of open documents.

↑ Back to the top


Cause

This problem may occur if you have an information rights management document open and a non-information rights management document open in the Microsoft Office 2003 program at the same time.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


More information

For more information about information rights management, visit the following Microsoft Web site:

↑ Back to the top


Keywords: KB821079, kbprb, kberrmsg, kbprogramming, kbmacro, kbvba

↑ Back to the top

Article Info
Article ID : 821079
Revision : 3
Created on : 12/14/2006
Published on : 12/14/2006
Exists online : False
Views : 404