Suppress "OK to delete?" dialog
Suppress "OK to delete?" dialog
(OP)
How can I suppress the dialog box that warns the user that a worksheet will be permanently deleted? I'm just deleting a temporary worksheet that I used during my code like this:
Dim Wks as Worksheet
Set Wks = Worksheets.Add( _
After:=Worksheets(Worksheets.Count), _
Type:=xlWorksheet)
'[do work with Wks here]
Wks.delete
Dim Wks as Worksheet
Set Wks = Worksheets.Add( _
After:=Worksheets(Worksheets.Count), _
Type:=xlWorksheet)
'[do work with Wks here]
Wks.delete





RE: Suppress "OK to delete?" dialog
Use the following:
Dim Wks as Worksheet
Set Wks = Worksheets.Add( _
After:=Worksheets(Worksheets.Count), _
Type:=xlWorksheet)
'[do work with Wks here]
Application.DisplayAlerts = False
Wks.delete
Application.DisplayAlerts = True
HTH
Mike
RE: Suppress "OK to delete?" dialog