Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message Box ByPass 3

Status
Not open for further replies.

Bass71

MIS
Jun 21, 2001
79
I am writing a Macro that seeks to delete sheets that do not meet certain name criteria. However, when the Macro runs, a warning box appears with each sheet to be deleted. Is there any code I can input that will bypass this warning and make one systematic delete?

Here's the code:


While ActiveSheet.Name <> &quot;Sort&quot;
If ActiveSheet.Name <> &quot;SortRef&quot; And ActiveSheet.Name <> &quot;Sort&quot; Then
ActiveWindow.SelectedSheets.Delete
Else: ActiveSheet.Next.Select
End If
Wend


Thanks for your help..........................
 
I've never written a Macro, but in several VB projects that I've done in which I make a connection to Excel, and do some spreadsheet stuff, I got rid of all of those annoying message boxes by setting DisplayAlerts = False

I use the Excel Connection object to issue DisplayAlerts. I'm not sure what Excel object supports this, but it shouldn't be too difficult to figure out. I hope this helps.
 
Before you run your loop, add this line of code:

Code:
Application.DisplayAlerts = False

and after your loop, set it to true...
 
Hackster, why do you always hit &quot;Submit&quot; before me?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top