XL97: ActiveMenuBar.Index Different than Earlier Versions

Last reviewed: February 27, 1998
Article ID: Q155456
The information in this article applies to:
  • Microsoft Excel 97 for Windows

SYMPTOMS

In Microsoft Excel 97, when you run a Microsoft Visual Basic for Applications macro that contains the following code:

   MsgBox Application.ActiveMenuBar.Index

the value -4167 appears in a message box.

NOTE: When you run the macro from a Visual Basic module sheet in previous versions of Microsoft Excel, the value -4141 appears in a message box.

CAUSE

This behavior occurs when the following conditions are met:

  • You run the macro from a Microsoft Excel 97 worksheet.

        -or-
    
  • You run the macro from a module sheet in the Visual Basic Editor.

When you run a macro from the Visual Basic Editor in Microsoft Excel 97, Microsoft Excel is in "worksheet" mode, and the macro returns the value that indicates the worksheet menu bar is displayed.

The value -4167 appears because the Visual Basic Editor is a separate component of Microsoft Excel 97.

STATUS

This behavior is by design of Microsoft Excel 97.

MORE INFORMATION

In Microsoft Excel 97, a Visual Basic module sheet is part of the Visual Basic Editor; and the Visual Basic Editor is a separate component of Microsoft Excel. So, when you run the macro from the Visual Basic Editor, the macro returns the value -4167, which indicates that the worksheet menu bar is displayed.

In earlier versions of Microsoft Excel, a Visual Basic for Applications module sheet was part of a Microsoft Excel workbook.

The ActiveMenuBar property returns a CommandBar object that represents the active menu bar in the container application.


Additional query words: XL97 97
Keywords : kbcode xlwin
Version : WINDOWS:97
Platform : WINDOWS


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 27, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.