View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John Wilson John Wilson is offline
external usenet poster
 
Posts: 550
Default Force Read-Only?

Ed,

In the Workbook_Open Event......

Private Sub Workbook_Open()
If ActiveWorkbook.ReadOnly = False Then
ThisWorkbook.Saved = True
ThisWorkbook.ChangeFileAccess xlReadOnly
End If
End Sub

Note though that the user could still get to the VBA Editor and type
the following into the Immediate window:
ThisWorkbook.ChangeFileAccess xlReadWrite
To change it back.

John

Ed wrote:

I share a workbook (Excel 2000) on a company-wide server. The users will
filter and hide columns and rows, and I'm afraid someone will save the
changes so the next user opens up a file of garbage. I can right-click the
file icon and set the properties to Read-Only, but someone can simply change
it back, then do their damage.

Is it possible to create a BeforeOpen event that will force this to
Read-Only, regardless of what the user has done before opening the file?

Ed