![]() |
Set as read only based on user name.
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 -- skuzapo ------------------------------------------------------------------------ skuzapo's Profile: http://www.excelforum.com/member.php...o&userid=27430 View this thread: http://www.excelforum.com/showthread...hreadid=475174 |
Set as read only based on user name.
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 "skuzapo" wrote: 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 -- skuzapo ------------------------------------------------------------------------ skuzapo's Profile: http://www.excelforum.com/member.php...o&userid=27430 View this thread: http://www.excelforum.com/showthread...hreadid=475174 |
All times are GMT +1. The time now is 02:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com