ukdane
03-23-2010, 06:21 AM
I have some code in the sheetbeforerightclick on ThisWorkbook.
You can see the code below.
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Dim MyMenu As CommandBarButton
On Error Resume Next
With Application
.CommandBars("Cell").Reset
Set MyMenu = .CommandBars("Cell").Controls.Add(Temporary:=True)
End With
With MyMenu
.Caption = "Filter"
.Style = msoButtonCaption
.OnAction = "Filtershow"
End With
On Error GoTo 0
Set MyMenu = Nothing
End Sub
However I've tried to make the .xls into a .xla
As soon as I do this, because the code is found on the ThisWorkbook the right click no longer works. As it is not found on ThisWorkbook for the new book.
How do I get this code to work for the addin?
Thanks i.a.
You can see the code below.
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Dim MyMenu As CommandBarButton
On Error Resume Next
With Application
.CommandBars("Cell").Reset
Set MyMenu = .CommandBars("Cell").Controls.Add(Temporary:=True)
End With
With MyMenu
.Caption = "Filter"
.Style = msoButtonCaption
.OnAction = "Filtershow"
End With
On Error GoTo 0
Set MyMenu = Nothing
End Sub
However I've tried to make the .xls into a .xla
As soon as I do this, because the code is found on the ThisWorkbook the right click no longer works. As it is not found on ThisWorkbook for the new book.
How do I get this code to work for the addin?
Thanks i.a.