Suppress Error Dialog: "Data may exist in the sheet(s) selected for deleting...."

  • Thread starter (PeteCresswell)
  • Start date
P

(PeteCresswell)

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?
 
J

Jim Rech

Application.DisplayAlerts = False

--
Jim
| 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top