ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   msgbox (https://www.excelbanter.com/excel-programming/338646-msgbox.html)

Kjeldc

msgbox
 
I want to delete a worksheet, every time I open a workbook, but how can I
stop the msgbox from popping up with the message " Data may exist...... ?

Regards Kjeldc

Kjeldc

msgbox
 
Just what I needed. Thanks Jim.

"Jim Thomlinson" skrev:

You need to toggle the display alerts setting...
Application.DisplayAlerts = False
Application.DisplayAlerts = True
As with any application level setting you are best off to use an error
handler something like this (in case your code crashes you need to reset the
application)

sub Stuff()
On error goto ErrorHandler
Application.DisplayAlerts = False

Sheet1.Delete
ErrorHandler:
Application.DisplayAlerts = True
end sub

--
HTH...

Jim Thomlinson


"Kjeldc" wrote:

I want to delete a worksheet, every time I open a workbook, but how can I
stop the msgbox from popping up with the message " Data may exist...... ?

Regards Kjeldc


Jim Thomlinson[_4_]

msgbox
 
You need to toggle the display alerts setting...
Application.DisplayAlerts = False
Application.DisplayAlerts = True
As with any application level setting you are best off to use an error
handler something like this (in case your code crashes you need to reset the
application)

sub Stuff()
On error goto ErrorHandler
Application.DisplayAlerts = False

Sheet1.Delete
ErrorHandler:
Application.DisplayAlerts = True
end sub

--
HTH...

Jim Thomlinson


"Kjeldc" wrote:

I want to delete a worksheet, every time I open a workbook, but how can I
stop the msgbox from popping up with the message " Data may exist...... ?

Regards Kjeldc



All times are GMT +1. The time now is 11:18 AM.

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