ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opening as Read Only (https://www.excelbanter.com/excel-programming/301912-opening-read-only.html)

ianripping[_69_]

Opening as Read Only
 
I have set up a macro to open a file as read only, when I open it, i
does open as read only.

When I close it, it asks me if I would like to save the changes
although this happens you cant save the file - because it is rea
only.

Is there a way of getting rid of this dialog box so that the optio
doesnt come up to save as and the file just closes

--
Message posted from http://www.ExcelForum.com


Dave Peterson[_3_]

Opening as Read Only
 
But you could save it as a new name. If you want make it more difficult to do
even that:

Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.Saved = True
End Sub

Under the ThisWorkbook module.

You may want to put a little workaround for yourself:

Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If LCase(Application.UserName) Like "*ianripping*" Then
'nothing special
Else
Me.Saved = True
End If
End Sub

This looks like a problem just waiting to happen for the developer (you???).

When you spend more than a few minutes making changes and close by mistake,
you'll be sorry <vbg.


"ianripping <" wrote:

I have set up a macro to open a file as read only, when I open it, it
does open as read only.

When I close it, it asks me if I would like to save the changes,
although this happens you cant save the file - because it is read
only.

Is there a way of getting rid of this dialog box so that the option
doesnt come up to save as and the file just closes?

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson



All times are GMT +1. The time now is 03:49 PM.

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