Automatic dialog box selections

MrKowz

Well-known Member
Joined
Jun 30, 2008
Messages
6,653
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am writing a VBA macro right now that opens and closes multiple workbooks and worksheets. Is there any command I can put into my macro that will automatically tell Excel it is OK to delete this worksheet and to not save the workbook I am trying to close?

Basically, I have:

Windows("Filename<WORKBOOKNAME>").Activate
ActiveWindow.Close

and I want to bypass the confirmation box that comes up.

Any ideas would be much appreciated.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Welcome to the board...

Try

Application.DisplayAlerts = False


Set back to TRUE at the end of your code..
 
Upvote 0
Perfect! Worked like a charm! Thanks for the info, and thank you for the welcome; I will likely be posting here every so often, as I am developing many macros for my employer.
 
Upvote 0

Forum statistics

Threads
1,215,701
Messages
6,126,297
Members
449,308
Latest member
VerifiedBleachersAttendee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top