ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   close workbook without saving or promt to save (https://www.excelbanter.com/excel-discussion-misc-queries/255305-close-workbook-without-saving-promt-save.html)

ATVNSHANE

close workbook without saving or promt to save
 
i am new to excel 2007 and when closing the only visible sheet in my workbook
i need it to close the workbook without offering option to save. i have tried
to use macros but i dont think im doing it correctly. i have a active button
that works but i would like it to work when you close from the top right x or
exit excel button.

shane

Gord Dibben

close workbook without saving or promt to save
 
In Thisworkbook module of your workbook.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub

Note you have to save at least once before closing first time or you will
lose the code your just pasted into the module.


Gord Dibben MS Excel MVP

On Wed, 3 Feb 2010 17:57:01 -0800, ATVNSHANE
wrote:

i am new to excel 2007 and when closing the only visible sheet in my workbook
i need it to close the workbook without offering option to save. i have tried
to use macros but i dont think im doing it correctly. i have a active button
that works but i would like it to work when you close from the top right x or
exit excel button.

shane



ATVNSHANE

close workbook without saving or promt to save
 
i used alt f11 and add module, enter code. exit back to worksheet and saved
then close. when i went back in it still promt to save when closing. is that
the correct place to enter code?

"Gord Dibben" wrote:

In Thisworkbook module of your workbook.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub

Note you have to save at least once before closing first time or you will
lose the code your just pasted into the module.


Gord Dibben MS Excel MVP

On Wed, 3 Feb 2010 17:57:01 -0800, ATVNSHANE
wrote:

i am new to excel 2007 and when closing the only visible sheet in my workbook
i need it to close the workbook without offering option to save. i have tried
to use macros but i dont think im doing it correctly. i have a active button
that works but i would like it to work when you close from the top right x or
exit excel button.

shane


.


ATVNSHANE

close workbook without saving or promt to save
 
Thank you for your time, i just got it figured out.

"Gord Dibben" wrote:

In Thisworkbook module of your workbook.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub

Note you have to save at least once before closing first time or you will
lose the code your just pasted into the module.


Gord Dibben MS Excel MVP

On Wed, 3 Feb 2010 17:57:01 -0800, ATVNSHANE
wrote:

i am new to excel 2007 and when closing the only visible sheet in my workbook
i need it to close the workbook without offering option to save. i have tried
to use macros but i dont think im doing it correctly. i have a active button
that works but i would like it to work when you close from the top right x or
exit excel button.

shane


.



All times are GMT +1. The time now is 07:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com