Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2006

Tip: Looking for answers? Try searching our database.

VBA Bypass Delete Sheet Warning

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bill_morgan - 28 Feb 2006 18:16 GMT
Friends,

I have written VBA code that loops through 150 workbooks and performs
various tasks on each workbook. One task I need to perform is deleting one
sheet in each workbook.

Problem is, the Excel Delete Sheet Warning message box appears before each
deletion, which means I need to manually confirm the deletion 150 times. Is
there a VBA way to turn off Excel's delete sheet warning (like there is in
Access)?

Thanks for your help ...

bill morgan
Gary Keramidas - 28 Feb 2006 18:18 GMT
something like this

Sub delsheet()

Application.DisplayAlerts = False
Worksheets("sheet3").Delete
Application.DisplayAlerts = True
End Sub

Signature

Gary

> Friends,
>
[quoted text clipped - 10 lines]
>
> bill morgan
bill_morgan - 28 Feb 2006 22:50 GMT
So simple!  Thanks, Gary ...

> something like this
>
[quoted text clipped - 19 lines]
> >
> > bill morgan
Jim Thomlinson - 28 Feb 2006 18:18 GMT
application.displayalerts = false
sheets("Whatever").Delete
application.displayalerts = true
Signature

HTH...

Jim Thomlinson

> Friends,
>
[quoted text clipped - 10 lines]
>
> bill morgan
bill_morgan - 28 Feb 2006 22:50 GMT
Excellent.   Thank you,  Jim ...

> application.displayalerts = false
> sheets("Whatever").Delete
[quoted text clipped - 14 lines]
> >
> > bill morgan
Ron de Bruin - 28 Feb 2006 18:24 GMT
Hi Bill

You can use this

Application.DisplayAlerts = False
'Code
Application.DisplayAlerts = True

Signature

Regards Ron de Bruin
http://www.rondebruin.nl

> Friends,
>
[quoted text clipped - 10 lines]
>
> bill morgan
bill_morgan - 28 Feb 2006 22:51 GMT
Thanks, Ron.  Everybody giving me the same answer, so must be the BEST way ...

> Hi Bill
>
[quoted text clipped - 18 lines]
> >
> > bill morgan
davesexcel - 28 Feb 2006 18:26 GMT
Sub ..
Application.DisplayAlerts = False
'your code here ...
Application.DisplayAlerts = True
End Su
bill_morgan - 28 Feb 2006 22:51 GMT
Thanks, Dave.  Glad I asked ... so simple, but would have taken me awhile to
figure out.

> Sub ..
> Application.DisplayAlerts = False
> 'your code here ...
> Application.DisplayAlerts = True
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.