One of the users is getting the following error message:
Runtime Error '2147467259 (80004005)':
Method 'OnAction' of object 'CommandBarButton' Failed.
The following is the code:
Private Sub Workbook_Open()
Dim MyCommandBar As CommandBar
Dim MyControl As CommandBarButton
For Each MyCommandBar In Application.CommandBars
If MyCommandBar.Visible = True Then
If MyCommandBar.Name = "Worksheet Menu Bar" Then
Set MyControl = MyCommandBar.Controls.Add(msoControlButton, , , , True)
MyControl.Caption = "GFS BW Printing"
MyControl.Style = msoButtonCaption
MyControl.Visible = True
MyControl.OnAction = "GFS_Printing_Macro"
End If
End If
Next
End Sub
Dim MyControl As CommandBarButton
For Each MyCommandBar In Application.CommandBars
If MyCommandBar.Visible = True Then
If MyCommandBar.Name = "Worksheet Menu Bar" Then
Set MyControl = MyCommandBar.Controls.Add(msoControlButton, , , , True)
MyControl.Caption = "GFS BW Printing"
MyControl.Style = msoButtonCaption
MyControl.Visible = True
MyControl.OnAction = "GFS_Printing_Macro"
End If
End If
Next
End Sub
Any help will be appreciated...Thanks in advance..

Method 'OnAction' of object 'CommandBarButton' Failed
RickAppleton
Luiso
Mike Barry
Hi
I didn't have any problems with either Excel 2003 SP2, or 2000 SP3.
I found the following at ...
http://www.asap-utilities.com/blog/index.php/2005/09/19/method-add-of-object-commandbarcontrols-failed/
------------------------------------------------
Often this is a corrupt or bloated toolbar file. A *normal* size is < 30 kb. The .xlb file has all Toolbar customization in it.
You can try the following:
Close Excel
Do a search for .xlb in windows
Rename the file you find, e.g. rename the .xlb to .bac (my file is named Excel10.xlb in 2002, Excel11.xlb in 2003)
If you make your own toolbars or add buttons to the others this file is important (backup it so you can restore it)
Deleting the file or renaming will do no harm on your system, Excel will automaticly create a new one for you.
(However you lost your customization remember that)
Start Excel
I've got reported back from several people that this did the trick
--------------------------------------------------
I can't check it as I'm not seeing the problem, but it didn't seem to cause me any problems either.
Regards
Peter Mo.
AcrossThePond
Works for me in Excel. What version of Office are they running
Peter Mo.
JSarna