Microsoft KB Archive/130583

= Run-time Error Adding Button to Toolbar =

Article ID: 130583

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Excel 95 Standard Edition

-



This article was previously published under Q130583





SYMPTOMS
In Microsoft Excel, when you use the Add method of the ToolbarButtons collection to add a button to a toolbar, you may receive the following error message:

Run-time error '1004': Add method of Toolbars class failed



CAUSE
This behavior occurs if you add a button using a button ID number that is not valid or does not have a corresponding button face. For example, button ID value 146 does not have a corresponding button, and you receive the error message described above when you add a button using this button ID value.

In Microsoft Excel, the valid toolbar button ID values range from 1 to 248. However, not every value in this range is available. A table of available toolbar buttons and their button ID values is included in the Toolbar Button ID Values topic in the Visual Basic Reference. Some values are not available, and are correctly displayed in the table of available toolbar buttons as N/A.

