close excel without saving
If the code prevents saving the workbook, then how are you going to save the
workbook after you enter the code.
What you have to do is go to the immediate window and enter
Application.EnableEvents = False
now save the workbook and close it.
Go to the immediate window and enter
Application.EnableEvents = True
to reenable events.
--
Regards,
Tom Ogilvy
"Mike" wrote in message
...
Tom,
Thanks for that. I haven't tried it yet 'coz I didn't understand the
'disable macros first' comment and the workbook contains loads of macros
which would take for ever to disable. I am wanting other users not to be
able
to save changes when using the excel 'X' 's (quit buttons) nor to see a
save
prompt.
Mike
"Tom Ogilvy" wrote:
in the ThisWorkbook module
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
cancel = True
End Sub
After you add the code, you will have to disable macros manually, then
save
the workbook.
--
Regards,
Tom Ogilvy
"Mike" wrote in message
...
I have inserted various code(s) in vbs "this workbook" using private
sub
auto_close
and private sub work_book close() after other code to close
excel/workbook
without saving or displaying a prompt but none seems to work.
I have used 'application.displayalerts = false'.' application.quit',
'thisworkbook.close savechanges:=false' etc etc in a variety of
different
combinations.
Perhaps I am placing the code in the wrong place or perhaps I should
be
saving before quitting or ..... ?
Can anyone help ?
Mike
|