XL5: Caller Does Not Return Hierarchical Menu Information

Last reviewed: September 12, 1996
Article ID: Q118796
The information in this article applies to:
  • Microsoft Excel for Windows, version 5.0

SYMPTOMS

In Microsoft Excel, when you use the Caller function, or the Caller property, and the macro currently running was started by choosing a menu command, the array of values returned does not include information about whether the command that ran the macro was located on a top level menu or on a submenu.

CAUSE

The Caller function, and the Caller property return information about the object that called the macro that is currently running. For example, if you run a macro by choosing a command on a menu, Caller returns an array of values specifying the position, the menu number, and the menu bar number of the command that you chose. Caller does not, however, return information about whether the command was located on a main menu, such as the File menu, or on a sub menu.

The information returned about the position of the command is the position of the command on the menu, regardless of whether it was a main menu, or a submenu. Therefore, Caller returns the same values for the first command located on a main menu, as for the first command located on a submenu of a menu item on that same menu.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected for the Caller function in Microsoft Excel version 5.0c and Microsoft Excel for Windows 95 version 7.0.

In Microsoft Excel versions 5.0c and 7.0, when you use the Caller function in a macro that you run by choosing a menu command, a horizontal array of four elements is returned. The additional element that is returned is the position of the menu item (on the main menu) that contains the submenu item that ran the macro.

For example, if you run the Caller function by choosing the second command on the File menu, Two, and then choosing the first command, Item One, on the submenu, the following horizontal array is returned:

   1, 1, 10, 2

where the position of the command (Item One) on the submenu is 1, the menu (File) is 1, the bar number (Worksheet and Macro sheet) is 10, and the position of the command on the main menu (Two) is 2. If the command that runs the macro is not located on a submenu, the value returned as the fourth element in the array is 0.

NOTE: This problem has not been corrected for the Caller property.

REFERENCES

For more information about Caller, choose the Search button in the Microsoft Excel Macro Functions Help and type:

   Caller function

For more information about the Caller Property, choose the Search button in the Visual Basic Reference and type:

   Caller Property


KBCategory: kbprg
KBSubcategory:

Additional reference words: 5.00



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