LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Error in CommandBars

I am getting an error:

Run-time error '-2147467259 (80004005)'
Method 'OnAction' of object '_CommandBarButton' failed


The error occurs in the following code:

Sub Create_DCA_Menu()
' Build Opening Menu Bar
Delete_DCA_Menu
Dim mynewbar, button1, button2, button3, button4, button5, mysubmenu
Set mynewbar = CommandBars(1).Controls.Add(Type:=msoControlPopup,
Temporary:=True)
With mynewbar
.Caption = "DCA Menu"
End With

Set button1 = mynewbar.Controls.Add(Type:=msoControlButton)
With button1
.Caption = "Open Menu"
.OnAction = ThisWorkbook.Name & "!Open_Menu" <--- The occurs here.
End With

Set button2 = mynewbar.Controls.Add(Type:=msoControlButton)
With button2
.Caption = "Setup Menu"
.OnAction = ThisWorkbook.Name & "!Setup_Menu"
End With

Set button3 = mynewbar.Controls.Add(Type:=msoControlButton)
With button3
.Caption = "Connection Record Validation"
.OnAction = "DisplayConnectionForm"
End With


Set mysubmenu = mynewbar.Controls.Add(Type:=msoControlPopup)
With mysubmenu
.Caption = "Help"
End With

Set button4 = mysubmenu.Controls.Add(Type:=msoControlButton)
With button4
.Caption = "Send Help Email"
.OnAction = ThisWorkbook.Name & "!Prepare_Help_Email"
End With

Set button5 = mysubmenu.Controls.Add(Type:=msoControlButton)
With button5
.Caption = "View Manual"
.OnAction = ThisWorkbook.Name & "!ViewHelpFile"
End With

End Sub

This code is in an Add-in and what makes this confusing is this sub used to
work fine and in fact if I run this in edit mode from the source .xls to the
Add-In, it works fine.

Any help would be very much appreciated.

--
Trefor
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CommandBars vs CommandBars(1).Controls Sean Excel Programming 3 April 3rd 06 01:34 PM
Commandbars - again micklloyd[_5_] Excel Programming 4 January 30th 06 08:32 AM
Commandbars PosseJohn Excel Programming 1 December 16th 05 05:51 PM
run time error on commandbars tango Excel Programming 1 October 23rd 04 08:26 AM
Commandbars Libby Excel Programming 1 August 8th 04 07:11 PM


All times are GMT +1. The time now is 08:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"