Incidentally, in the workbook you were trying to disable the 'Delete' for, place the following code into the 'ThisWorkBook' section of the VB Editor:
Private Sub Workbook_Activate()
Dim CommBarTmp, Commbar As CommandBar
For Each Commbar In Application.CommandBars
Set CommBarTmp = Commbar.FindControl(ID:=847, recursive:=True)
If Not CommBarTmp Is Nothing Then CommBarTmp.Enabled = False
Next
End Sub
Private Sub Workbook_Deactivate()
Dim CommBarTmp, Commbar As CommandBar
For Each Commbar In Application.CommandBars
Set CommBarTmp = Commbar.FindControl(ID:=847, recursive:=True)
If Not CommBarTmp Is Nothing Then CommBarTmp.Enabled = True
Next
End Sub
That will then disable the delete command whenever that workbook is active, and re-enable the delete command whenever that workbook is not active
Bookmarks