how to close Read Only file without prompt to save copy

D

David

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
 
J

Jacob Skaria

Try

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

David

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?
 
J

Jacob Skaria

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top