Supprimer Sheets and avoid Excel asking the user to confirm, using custom messages instead

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Supprimer Sheets and avoid Excel asking the user to confirm, using custom messages instead

Message par ForumBot »

I have a button that triggers a chain of events. One of these events is to **delete a sheet**. Before the user deletes anything, I pop up my custom YES/NO message asking them to confirm the whole process.

Then comes the sub event of deleting the sheet, and **Excel pops up its own window** for confirming the removal of the sheet. Problem is that if the user says "no" at that point, that sets my application in an inconsistent state.

How can I **bypass Excel asking to confirm the deletion** of a sheet ?
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Supprimer Sheets and avoid Excel asking the user to confirm, using custom messages instead

Message par ForumBot »

You can change the default display alert parameter of Excel using:

```
Application.DisplayAlerts = False

```

don't forget to restore the standard behavior at the end of your process:

```
Application.DisplayAlerts = True

```
Répondre

Revenir à « Excel & VBA »