ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Custom Right Click (https://www.excelbanter.com/excel-programming/413107-custom-right-click.html)

steven

Custom Right Click
 
I thought 1589 below was Insert Comment. The others show on the right click
but not the Insert Comment?

Thank you,

Steven

Sub RemoveRightClick()
Dim IDnum As Variant
Dim N As Integer
Dim Ctl As CommandBarControl

'Set Enabled to False for all the controls
For Each Ctl In CommandBars("Cell").Controls
On Error Resume Next
Ctl.Enabled = False
Ctl.Visible = False
On Error GoTo 0
Next Ctl

'Now set Enabled to True for the controls you want
IDnum = Array("19", "21", "22", "755", "1589")
For N = LBound(IDnum) To UBound(IDnum)
On Error Resume Next
Application.CommandBars("Cell").FindControl(ID:=ID num(N),
Recursive:=True).Enabled = True
Application.CommandBars("Cell").FindControl(ID:=ID num(N),
Recursive:=True).Visible = True
On Error GoTo 0
Next N
End Sub


Bob Phillips

Custom Right Click
 
It's 2031 according to my Excel.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Steven" wrote in message
...
I thought 1589 below was Insert Comment. The others show on the right
click
but not the Insert Comment?

Thank you,

Steven

Sub RemoveRightClick()
Dim IDnum As Variant
Dim N As Integer
Dim Ctl As CommandBarControl

'Set Enabled to False for all the controls
For Each Ctl In CommandBars("Cell").Controls
On Error Resume Next
Ctl.Enabled = False
Ctl.Visible = False
On Error GoTo 0
Next Ctl

'Now set Enabled to True for the controls you want
IDnum = Array("19", "21", "22", "755", "1589")
For N = LBound(IDnum) To UBound(IDnum)
On Error Resume Next
Application.CommandBars("Cell").FindControl(ID:=ID num(N),
Recursive:=True).Enabled = True
Application.CommandBars("Cell").FindControl(ID:=ID num(N),
Recursive:=True).Visible = True
On Error GoTo 0
Next N
End Sub





All times are GMT +1. The time now is 07:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com