Display Alert屬性

當刪除工作表時,隱藏警告訊息:
Sub DelSheet()
   Dim sheet As Worksheet
   Application.DisplayAlerts = False               '不顯示警告訊息
   For Each sheet As Worksheets
      If sheet.Name <> ActiveSheet.Name Then
         sheet.Delete
      End If
   Next
   Application.DisplayAlerts = True                '顯示警告訊息
End Sub