Protection

T

Tami

What is the best way to set up protection for a workbook
that is on a company shared drive? My department will
need to be able to make changes to the file, while other
departments I want them to only be able to read the file.
No options what so ever to make changes. I originally set
it up as read only, but users still have the options to
say no. Finally I just password protected it and gave the
password to my team. But, people are forgetful and they
do not password protect it again. Any suggestions?

Thanks
 
G

Guest

Pust this in your Workbook_Open subprocedure (located in
ThisWorkbook). This is how I have mine set up:

Private Sub Workbook_Open()

' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String

Application.ScreenUpdating = False
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If

'Checking authorization
Select Case fOSUserName


Case "d20027", "d19952", "d13571", "d13805", "d20072", "d35
058"
ActiveWorkbook.Unprotect Password:="cqafsr"
Case Else
MsgBox "You do not have access to this workbook.
If you think that this is in error, contact your System
Administrator.", vbOKOnly + vbCritical
Application.ScreenUpdating = True
Application.Quit
End Select

End Sub

If this doesn't work for you, go to www.mvps.org/access
 
D

Dave Peterson

I think I'd talk to the IT department. Ask them to create a share that your
team has read/write access, but readonly for others (or even some others--on a
per id basis).

I bet it would be handy for other stuff, too.
 
Top