Excel .DisplayAlerts 刪除工作表時不顯示警告資訊
技巧028
Sub CheckDeleteSheet() |
Dim bDeleted As Boolean |
bDeleted = Worksheets(1).Delete |
If bDeleted Then |
MsgBox "成功删除工作表。", vbInformation |
Else |
MsgBox "使用者取消删除。", vbInformation |
End If |
End Sub |
執行下面程式碼需保證存在Sheet1工作表物件 |
Sub DeleteSheetWithoutAlert() |
Application.DisplayAlerts = False |
Sheet1.Delete |
Application.DisplayAlerts = True |
End Sub |
留言
張貼留言