T
Trefor
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.
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.