View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default Suppress Error Dialog: "Data may exist in the sheet(s) selected for deleting...."

Application.DisplayAlerts = False

--
Jim
"(PeteCresswell)" wrote in message
...
| I'm running this code:
| --------------------------------------------------------------
| DoCmd.SetWarnings False
| On Error Resume Next
| With mySS
| .Worksheets("Sheet1").Delete
| .Worksheets("Sheet2").Delete
| .Worksheets("Sheet3").Delete
| End With
| On Error GoTo ProjectedPayments_SpreadsheetCreate_err
| DoCmd.SetWarnings True
| --------------------------------------------------------------
|
| in an effort to clean up any empty sheets the user's Excel
| options may have automagically created when my code
| creates/populates a .XLS.
|
|
| Similar code hasn't given me any trouble, but in this particular
| application, it's causing Excel to pop a warning/confirmation
| dialog:
|
| "Data may exist in the sheet(s) selected for deleting. To
| permanently delete the data, press Delete."
|
|
| I guess I'm doing something to make Excel think I've populated
| one or more cells in the sheets in question.
|
| Is there some way for me to suppress that dialog so the user
| doesn't have to see/respond to it?
| --
| PeteCresswell