Restore "Delete..." and "Insert..." shortcuts

M

markb

Hello,

I am using this code to disable insertion and deletion of rows/columns:

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Dim cBut As CommandBarControl
Dim iPostion As Integer
On Error Resume Next

Application.CommandBars("Cell").Controls("CLEAR ALL").Delete
With Application.CommandBars("Cell")
iPostion = .Controls("Delete...").Index
Set cBut = .Controls.Add(Before:=iPostion, Temporary:=True)
.Controls("Delete...").Delete
.Controls("insert...").Delete
With cBut
.Caption = "CLEAR ALL"
.OnAction = "ClearAll"
End With
End With
On Error GoTo 0


End Sub

I need to restore these to the shortcut menu when the application closes. I
can not seem to get the syntax right.

Please help?

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top