R
Rick A
Why am I seeing the dialog box prompt when deleting a worksheet?
From help for delete
When you delete a Workbook or Worksheet, this method displays a dialog box
that prompts the user to confirm the deletion. This dialog box is displayed
by default.
This example deletes Sheet3 in the active workbook without displaying the
confirmation dialog box.
Application.DisplayAlerts = False
Worksheets("Sheet3").Delete
Application.DisplayAlerts = True
I want to delete a sheet and not see the dialog box
..
My delete code
Function DeleteSheet(strSheetName As String) As Boolean
' This function deletes a sheet based on the individual name provided
' If the sheet is not found the code moves on.
On Error Resume Next
Application.DisplayAlerts = False
PriorityExcel.Sheets(strSheetName).Delete
Application.DisplayAlerts = True
End Function
PriorityExcell has been dimmed as "Dim PriorityExcel As Excel.Application"
and is set as an object in another part of the code.
Thanks
From help for delete
When you delete a Workbook or Worksheet, this method displays a dialog box
that prompts the user to confirm the deletion. This dialog box is displayed
by default.
This example deletes Sheet3 in the active workbook without displaying the
confirmation dialog box.
Application.DisplayAlerts = False
Worksheets("Sheet3").Delete
Application.DisplayAlerts = True
I want to delete a sheet and not see the dialog box
..
My delete code
Function DeleteSheet(strSheetName As String) As Boolean
' This function deletes a sheet based on the individual name provided
' If the sheet is not found the code moves on.
On Error Resume Next
Application.DisplayAlerts = False
PriorityExcel.Sheets(strSheetName).Delete
Application.DisplayAlerts = True
End Function
PriorityExcell has been dimmed as "Dim PriorityExcel As Excel.Application"
and is set as an object in another part of the code.
Thanks