Forum Discussion
Shared Excel File - Restricting Edits to Author
Like many companies we have shared drives with files that anyone can access and edit.
Is there a way for me to create a file and save it so I can open it, edit it, and save it without entering a password, while every other user can just open and view it, also without entering a password?
2 Replies
- mtarlerSilver Contributor
NE1Know Well if you are going to open the file in your desktop Excel you can use Macros to do this. Here is the code you want to have in "ThisWorkbook" sheet:
Private Const Owner = "Your UserName" Private Const PW = "password" Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim sh As Worksheet For Each sh In ThisWorkbook.Sheets Call sh.Protect(PW) Next End Sub Private Sub Workbook_Open() If Application.UserName = Owner Then Dim sh As Worksheet For Each sh In ThisWorkbook.Sheets Call sh.Unprotect(PW) Next End If End SubI have attached a sample sheet and included a button that will tell you your User Name
To get in and edit you click Alt-F11 to open the VB window and then right click 'ThisWorkbook' and then select Show Code:
If you don't see this menu on the left try clicking Ctrl-R
That all said, DO NOT consider this high security by ANY means.
- mathetesGold ContributorWhat's your problem with having to enter a password? You can protect the file so that only you can edit it, but yes, that requires a password. Why is that a barrier? You could make it a simple password, known only to you......others would not be able to do anything but view,