Hello! I have been dealing with this issue for some time now, hoping someone can help me out 
I have a set of workbooks that I refresh monthly. I took this over from someone else, who wrote the blue VBA code below. I believe the purpose of it is to only allow certain users to open and save the workbook, while forcing others to access it in read-only mode. I never had an issue doing this until recently when we upgraded from Office 2016 to Office 365. Now whenever I open the workbook I get the following error message:
Run-time error '1004': Cannot access read-only document '[workbook url]'.
When I select "debug", it jumps to the "User = UserStatus(1, 1)" line, which makes me think that my username [format is: "Doe, John (J.)"] is not being recognized. However, I can't tell why this is suddenly happening or how to fix it. I've tried searching for this issue but I cannot figure it out, so any and all help is greatly appreciated!
Sub Workbook_Open()
Dim User As Variant
Dim UserStop As IntegerApplication.DisplayAlerts = False
User = UserStatus(1, 1)
UserStop = InStr(User, "(") - 2
User = Mid(User, 1, UserStop)
If User = "Doe, John" Or User = "Doe, Jane" Then
On Error Resume Next
ThisWorkbook.LockServerFile
Else
ThisWorkbook.ChangeFileAccess Mode:=xlReadOnly
End If
Application.DisplayAlerts = True
End Sub
Bookmarks