Article ID: 171025 - Last Review: November 23, 2006 - Revision: 2.2 XL97: Macro Error Creating Custom Shortcut Menu ItemThis article was previously published under Q171025 SYMPTOMS
If you run a macro that creates a custom menu item on the worksheet
shortcut menu, you may receive the following error message:
Run-time error '-2147467259(80004005)': Method 'Add' of object 'CommandBarControls' failed CAUSE
This problem occurs if both of the following conditions are true:
If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites: Microsoft Certified Partners - https://partner.microsoft.com/global/30000104 (https://partner.microsoft.com/global/30000104) Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice (http://support.microsoft.com/gp/advisoryservice) For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms) For example, the following code generates an error: RESOLUTION
To create a custom menu item on the worksheet shortcut menu, use the syntax
for the Add method of the Menuitems object. For example, the following
sample code does not generate an error:
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article.
REFERENCES
For more information about custom menus items, click the Office Assistant
in the Visual Basic Editor, type custom menus, click Search, and then
click to view "Adding and managing menu bars and menu items."
NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If Microsoft Help is not installed on your computer, please see the following article in the Microsoft Knowledge Base: 120802
(http://support.microsoft.com/kb/120802/EN-US/
)
Office: How to Add/Remove a Single Office Program or Component
| Article Translations
|

Back to the top
