Murray Brown
asked on
VB.net Excel Add-In Right Click menu doesn't appear when clicking a pivot
Hi. I used the following code to build a rigt click menu. It works when I right click on the
Sheet but not when I click on the pivot
Dim cBut As CommandBarButton
Try
Application.CommandBars("C ell").Cont rols("My Macro").Delete()
Catch ex As Exception
'No message as error will occur if "My Macro" not there
End Try
Try
cBut = Application.CommandBars("C ell").Cont rols.Add(T emporary:= True)
With cBut
.Caption = "My Macro"
.Style = MsoButtonStyle.msoButtonCa ption
.OnAction = "My_Macro"
End With
Catch ex As Exception
MsgBox(ex.Message)
End Try
Sheet but not when I click on the pivot
Dim cBut As CommandBarButton
Try
Application.CommandBars("C
Catch ex As Exception
'No message as error will occur if "My Macro" not there
End Try
Try
cBut = Application.CommandBars("C
With cBut
.Caption = "My Macro"
.Style = MsoButtonStyle.msoButtonCa
.OnAction = "My_Macro"
End With
Catch ex As Exception
MsgBox(ex.Message)
End Try
The standard Cell menu is not displayed if you right-click a pivot cell - you get the "PivotTable Context Menu" instead.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Rory.