woipi
woipi

Reputation: 53

Disable right click menu of shapes

Is there a way to disable the right click menu for shapes like e.g. rectangles in VBA?

I tried:

Private Sub Workbook_Open()
'    Application.WindowState = xlMaximized
    Application.DisplayFullScreen = True
    Application.CommandBars("Ply").Enabled = False
    Application.CommandBars("Shapes").Enabled = False
End Sub

but this does not seem to work.

Upvotes: 4

Views: 2435

Answers (2)

woipi
woipi

Reputation: 53

I have attached some screenshots of my application just to describe what I want to archive.

The problem is that the menu is realy annoying when trying to select more than one shape.

enter image description here

enter image description here

Upvotes: 0

ashleedawg
ashleedawg

Reputation: 21639

The right-click menu (aka, context menu) is not a Command Bar.

You may know Command Bars by their older name, Toolbars, or their newer name, Ribbons.

Although you can capture and/or disable a right-click event on a worksheet, this doesn't apply to objects like shapes.

However, you can prevent the context menu from showing by protecting the worksheet from changes (with or without a password).

If necessary you can allow some changes, but not others, to be made by the user. More information at this link.

enter image description here

Upvotes: 2

Related Questions