Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

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("Cell").Controls("My Macro").Delete()
        Catch ex As Exception
            'No message as error will occur if "My Macro" not there
        End Try

        Try

            cBut = Application.CommandBars("Cell").Controls.Add(Temporary:=True)

            With cBut

                .Caption = "My Macro"

                .Style = MsoButtonStyle.msoButtonCaption

                .OnAction = "My_Macro"

            End With
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

The standard Cell menu is not displayed if you right-click a pivot cell - you get the "PivotTable Context Menu" instead.
ASKER CERTIFIED SOLUTION
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

Thanks Rory.