ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable option save when close excel (https://www.excelbanter.com/excel-programming/356024-disable-option-save-when-close-excel.html)

Rui Álvares

Disable option save when close excel
 
Hi,

I'm making a macro that open an excel document only for consulting.
So, if anybody makes changes in it, the changes can not be saved.
For that, when the document is closed, I need inhibit the window asking if
we want save it.
If anybody knows how make it, I'm very pleasure.

Thamks in advance.

Rui Álvares



davesexcel[_70_]

Disable option save when close excel
 

Exit without saving
Posted by Mark O'Brien on September 27, 2001 11:53 AM

Insert this code onto the workbook object
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Me.Saved = False Then Me.Saved = True
End Sub

that should work.


--
davesexcel
------------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=522415


Tom Ogilvy

Disable option save when close excel
 
Just a thought for the OP if looking for a reliable method, if Macros are
disabled, then this will not work.

You might make the workbook ReadOnly (although this can be defeated as
well).

--
Regards,
Tom Ogilvy


"davesexcel" wrote
in message ...

Exit without saving
Posted by Mark O'Brien on September 27, 2001 11:53 AM

Insert this code onto the workbook object
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Me.Saved = False Then Me.Saved = True
End Sub

that should work.


--
davesexcel
------------------------------------------------------------------------
davesexcel's Profile:

http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=522415





All times are GMT +1. The time now is 10:24 AM.

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