ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to close Read Only file without prompt to save copy (https://www.excelbanter.com/excel-programming/442351-how-close-read-only-file-without-prompt-save-copy.html)

David

how to close Read Only file without prompt to save copy
 
Hi
I'm working on an Excel file that will always be opened as Read Only by users.
To save confusion I would rather the user is not prompted to save the file
on exit.
I've tried application.displayAlerts = False in the Workbook BeroreClose
event code
but no joy so far.
Is it posible to achieve this?
Thanks

Jacob Skaria

how to close Read Only file without prompt to save copy
 
Try

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.Close False
End Sub


--
Jacob (MVP - Excel)


"David" wrote:

Hi
I'm working on an Excel file that will always be opened as Read Only by users.
To save confusion I would rather the user is not prompted to save the file
on exit.
I've tried application.displayAlerts = False in the Workbook BeroreClose
event code
but no joy so far.
Is it posible to achieve this?
Thanks


David

how to close Read Only file without prompt to save copy
 
Thanks Jacob (I made sure to click on yes)

Worked fine

Is there any way to close the application "shell" along with the file
as is usual with only a single file open?

"Jacob Skaria" wrote:

Try

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.Close False
End Sub


--
Jacob (MVP - Excel)


"David" wrote:

Hi
I'm working on an Excel file that will always be opened as Read Only by users.
To save confusion I would rather the user is not prompted to save the file
on exit.
I've tried application.displayAlerts = False in the Workbook BeroreClose
event code
but no joy so far.
Is it posible to achieve this?
Thanks


Jacob Skaria

how to close Read Only file without prompt to save copy
 
Ofcourse YES; Try the below. Be careful this will quit the app; even if you
have other workbooks open..


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
Application.Quit
End Sub

--
Jacob (MVP - Excel)


"David" wrote:

Thanks Jacob (I made sure to click on yes)

Worked fine

Is there any way to close the application "shell" along with the file
as is usual with only a single file open?

"Jacob Skaria" wrote:

Try

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.Close False
End Sub


--
Jacob (MVP - Excel)


"David" wrote:

Hi
I'm working on an Excel file that will always be opened as Read Only by users.
To save confusion I would rather the user is not prompted to save the file
on exit.
I've tried application.displayAlerts = False in the Workbook BeroreClose
event code
but no joy so far.
Is it posible to achieve this?
Thanks



All times are GMT +1. The time now is 10:15 PM.

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