Macro to close a workbook without asking to save?

MrHibs

New Member
Joined
Sep 8, 2006
Messages
18
Hi guys,

I need a macro code that will eliminate the "Do you wish to save" message and automatically close a workbook without saving.

Basically there's about 50 people who in theory could be running a macro at the same time to extract data from a separate spreadsheet. We've made this spreadsheet shared to cater for this but it still pops up with the "Do you wish to save" message.

Can anyone help?
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi,

one of the options:
try this in THISWORKBOOK-module
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Close False
End Sub
kind regards,
Erik
 

Watch MrExcel Video

Forum statistics

Threads
1,119,104
Messages
5,576,140
Members
412,700
Latest member
IIII
Top