Prevent "Do you want to Save" when Read Only


Posted by Zif on February 08, 2001 4:28 AM

Hiya
Ii have several workbooks which are opened by different users. Some open the files as Read/Write (in which case they will need to be prompted to save changes if they have not already done so), and some open the files as Read Only.

When the files are opened as Read Only, how can I prevent the "do you want to save changes" message from being displayed?


Zif.



Posted by Dave Hawley on February 08, 2001 5:15 AM

Hi Zif

This should work, but I haven't tested it.

Right click on the sheet picture, top left next to "File", select "View Code and paste this in:

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

Good luck

Dave
OzGrid Business Applications