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.

XL2000: Cannot Make Changes to Some Shortcut Menus


View products that this article applies to.

This article was previously published under Q213563

↑ Back to the top


Symptoms

In Microsoft Excel, when you run a Microsoft 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
				

↑ Back to the top


Cause

In Microsoft Excel, 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.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


More information

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to 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 requirements.
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
				

↑ Back to the top


Keywords: KB213563, kbpending, kbdtacode, kbbug

↑ Back to the top

Article Info
Article ID : 213563
Revision : 7
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 249