Set as read only based on user name.

S

skuzapo

Hi all,

I need to restrict access to a workbook based on the user name of the
person opening the workbook. I don't want to use passwords and
protection as I don't need that file to be all that secure. So I've got
the following macro to change the status of the sheet based on the user
name.

This seems to work but it is possible to change the user name in
Tools\Options and reopen the sheet with write access.

Private Sub workbook_open()

Select Case Application.UserName
Case Is = "Pippa"
End
Case Else
ActiveWorkbook.ChangeFileAccess Mode:=xlReadOnly
End Select

End Sub

Any better suggestions?
Thanks in advance
 
G

Guest

You wouldn't bother using a login for the file if you didn't want it somewhat
secure. So you could...

In the file select saveAs, then in the tools dropdown open up 'General
Options'

Use a password to open and a separate to modify. Those with access to open
can open and those with the password to modify can modify. Make sure you
also check the read only recommended button.

JNW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top