XL97: Cannot Make Changes to Some Shortcut Menus

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

SYMPTOMS

In Microsoft Excel 97, when you run a Visual Basic for Applications macro that adds, removes, or modifies menu items on certain shortcut menus, the changes do not appear. The following shortcut menus are affected.

   Shortcut menu    xlConstant
   --------------------------------

   Button           xlButton
   Drawing object   xlDrawingObject
   Text box         xlTextBox

CAUSE

In Microsoft Excel 97, you cannot make these changes to the xlButton, xlDrawingObject, and xlTextBox shortcut menus. However, if you run a macro that attempts to make such changes, the macro does not fail, and the changes do not appear on the appropriate shortcut menus.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/support/supportnet/refguide/default.asp

In Microsoft Excel, when you click with the right mouse button (right- click) any type of object in a worksheet, chart sheet, or dialog sheet, a shortcut menu appears with commands (menu items) that apply to the selected object.

You can make changes to shortcut menus by using the ShortcutMenus, MenuItems, Add, and Delete methods in a Visual Basic macro. For example, if you want to add a custom menu item to the xlWorksheetCell shortcut menu (the shortcut menu that appears when you right-click a cell in a worksheet), you use the following code:

   Sub AddCustom()
       Application.ShortcutMenus(xlWorksheetCell).MenuItems.Add _
           Caption:="C1"
   End Sub

If you want to delete the same menu item, you would use the following code:

   Sub DelCustom()
       Application.ShortcutMenus(xlWorksheetCell).MenuItems("C1").Delete
   End Sub


Additional query words: XL97 97
Keywords : kbcode xlvbahowto xlvbainfo xlui xl97vbmigrate
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbbug


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.