XL5: Caller Does Not Return Hierarchical Menu Information

ID: Q118796

5.00 WINDOWS kbprg fixlist5.00c

The information in this article applies to:

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

Version           : 5.00
Platform          : WINDOWS

Last Reviewed: September 14, 1996