ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Hiding, or automatically answering, a confirmation msgbox (https://www.excelbanter.com/excel-discussion-misc-queries/101887-hiding-automatically-answering-confirmation-msgbox.html)

Brian Beck

Hiding, or automatically answering, a confirmation msgbox
 
In a macro I have, I create a new worksheet to do some work in and then
later in the macro, I delete the worksheet since it is no longer needed.
(There is another worksheet in this workbook that is always there when this
macro runs) When the macro sends the command to delete the worksheet, a
msgbox pops up telling me that there may be data in the worksheet I'm
deleting and am I sure that I want to delete it. I click on the "Delete"
button and the macro continues on its merry way.

How can I either get rid of the msgbox appearing, or put something in the
macro that will automatically select "Delete" on the msgbox so that there is
no interaction from the user required for the macro to finish running?

-Brian



mattyboy150279

Hiding, or automatically answering, a confirmation msgbox
 
In your code to delet the sheet you need to insert:-

Application.DisplayAlerts = false

following this you then need the code to delete the sheet and then you
need to have:-

Application.DisplayAlerts = True

To turn the alerts back on again, otherwise you wont be alerted about
anything else which may happen in your sheet.

Hope this helps,
Mat
For Excel Tutorials and Tips: http://teachr.blogspot.com


Brian Beck wrote:
In a macro I have, I create a new worksheet to do some work in and then
later in the macro, I delete the worksheet since it is no longer needed.
(There is another worksheet in this workbook that is always there when this
macro runs) When the macro sends the command to delete the worksheet, a
msgbox pops up telling me that there may be data in the worksheet I'm
deleting and am I sure that I want to delete it. I click on the "Delete"
button and the macro continues on its merry way.

How can I either get rid of the msgbox appearing, or put something in the
macro that will automatically select "Delete" on the msgbox so that there is
no interaction from the user required for the macro to finish running?

-Brian




All times are GMT +1. The time now is 08:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com