Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 194
Default Force Read-Only?

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 194
Default Force Read-Only?

Thank you, John. This may have solved a big issue for me.

I'm not so worried about a our users going into the code. Most of them are
"trained" well enough not to do that. But we do have ways of tracking down
the others.

Ed


"John Wilson" wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Force excel to read dates as D/M/YYYY S Davis Excel Worksheet Functions 6 May 12th 08 07:00 PM
Force read-only in auto_open macro hhalle Excel Discussion (Misc queries) 0 August 20th 06 10:44 AM
I have a read only xl file, I need it to be read and write drama queen Excel Discussion (Misc queries) 3 July 1st 06 12:25 AM
How can a file be converted from Read-Only to Read/Write Jim in Apopka Excel Discussion (Misc queries) 2 November 19th 05 04:59 PM
Force File Read-Only? Ed[_9_] Excel Programming 1 July 21st 03 10:22 PM


All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"