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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

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,112,885
Messages
5,543,033
Members
410,583
Latest member
gazz57
Top