Multiple Users to open a file READ ONLY immediately?

FinancialAnalystKid

Well-known Member
Joined
Oct 14, 2004
Messages
779
How can I share a file on a network drive where a user can open it ONLY as a read only without going through process of clicking 'read only' on a file that is protected?

Adding an 'extra step' to a simple process like opening an excel file has caused many non-experienced excel users a little frustration both on their end and my end.

I want a file that they can open, and it immediately opens for them as a READ ONLY while when I open it, I can do administrative work on it at the same time, etc.

Thanks!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
This worked for me in Excel 2007:

Private Sub Workbook_Open()
Dim myname As String
Dim myFile As String
myname = Environ("USERNAME")
myFile = "C:\Documents and Settings\jharris90\Desktop\Test.xlsb"
If myname <> "YourUserName" Then
Workbooks.Open Filename:=myFile, ReadOnly:=True
End If
End Sub
 
Upvote 0
This worked for me in Excel 2007:

Private Sub Workbook_Open()
Dim myname As String
Dim myFile As String
myname = Environ("USERNAME")
myFile = "C:\Documents and Settings\jharris90\Desktop\Test.xlsb"
If myname <> "YourUserName" Then
Workbooks.Open Filename:=myFile, ReadOnly:=True
End If
End Sub


Does this have to go into every worksheet in the workbook?
 
Upvote 0
No it goes in the Workbook_Open event code.

Open VB Editor and double click the Object "This Workbook" underneath all the sheet names. Paste the entire code in that window.
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top