View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben
 
Posts: n/a
Default How can I disable system alerts (deleting a sheet for example)

Andrii

You could assign the macro to the EditDelete Sheet menu item through
ToolsCustomize.

You could also assign it to the Delete Sheet on the sheet tab right-click menu
item.

This would be more complex and would require changing the right-click
menu("Ply")

Private Sub Workbook_Open()
Application.CommandBars("Ply").Controls("Delete"). Delete
With Application.CommandBars("Ply").Controls.Add(tempor ary:=True)
.BeginGroup = True
.Caption = "Delete Sheet no Warning"
.OnAction = "MyMacros.xla" & "!SheetDelete"
End With
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Ply").Reset
End Sub


Gord

On Fri, 16 Dec 2005 09:19:02 -0800, "andriil"
wrote:

Mr. Dibben,
thank you for the macro.
Is there any way to avoid using some custom buttons? I used to tie my macros
to workbook, worksheet or application events, but I can't find anything like
"worksheet_delete" event or something... Does anything like this exist?
Thanks again.
Andrii.

"Gord Dibben" wrote:

Sub SheetDelete()
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
End Sub

Assign to a button or shortcut key-combo.


Gord Dibben Excel MVP

On Fri, 16 Dec 2005 05:37:03 -0800, "andriil"
wrote:

Every time delete a sheet, I get a system alert saying "Data may exist in the
sheet(s) selected for deletion. To permanently delete the data, press
Delete". It's a bit annoying when you have to delete many sheets and you
don't want to select multiple sheets. Is there any possibility to disable
this alert?