View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
MarkB MarkB is offline
external usenet poster
 
Posts: 21
Default Restore "Delete..." and "Insert..." shortcuts

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(Befo=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,
--
Markb