ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Force File Read-Only? (https://www.excelbanter.com/excel-programming/272243-force-file-read-only.html)

Ed[_9_]

Force File Read-Only?
 
I am using Win2000 and Excel 2000. I put a workbook onto a company-wide
server, and I'm afraid users are going to screw it up so another user opens
a file of garbage. The users are going to have to be able to filter and
hide columns and rows.

I can right-click on the file and set its property to Read-Only, so no
changes get saved when the file closes. But I'm concerned that someone will
simply turn it off. Is there any way to code a BeforeOpen action that will
set this property to Read-Only, regardless of how it was checked/unchecked
when the user opened it?

Ed



Bill Lunney

Force File Read-Only?
 
Sounds like you're better just blocking the Save event altogether.
Something like this added to the workbook code module will do the job.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Cancel = True
End Sub

This has the advantage that you can specifiy the criteria used to decide if
a file can be saved.


http://www.billlunney.com/Excel/FAQ/...ExcelFAQID=211


--

Regards,


Bill Lunney
www.billlunney.com

"Ed" wrote in message
...
I am using Win2000 and Excel 2000. I put a workbook onto a company-wide
server, and I'm afraid users are going to screw it up so another user

opens
a file of garbage. The users are going to have to be able to filter and
hide columns and rows.

I can right-click on the file and set its property to Read-Only, so no
changes get saved when the file closes. But I'm concerned that someone

will
simply turn it off. Is there any way to code a BeforeOpen action that

will
set this property to Read-Only, regardless of how it was checked/unchecked
when the user opened it?

Ed






All times are GMT +1. The time now is 06:01 PM.

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