Reputation: 665
I need to get the Name of the Read/Write user of an opened Woorkbook.
I tried already this users = ActiveWorkbook.UserStatus
but this doesn't work as I want, I get only one user "my Name" even there is another user.
So when I open an WorkBook already opened by another user, I want to get the name of this user.
Is that possible using VBA.
Upvotes: 0
Views: 1880
Reputation: 43575
:) Any user would get its name written, if he opens it with Environ("Username")
. Go to another PC and check it. Environ("Username") gives the name of the current Windows User.
Edit: If you are speaking about shared workbooks, this is the code:
Sub getListUsingUsers()
Users = ActiveWorkbook.UserStatus
MsgBox "Total Users using the current WorkBook: " & UBound(Users)
End Sub
Edit2:
Sub GetUsers()
Dim users As Variant
Dim l_counter As Long
users = ActiveWorkbook.UserStatus
Debug.Print "Total Users using the current WorkBook: " & UBound(users)
For l_counter = 1 To UBound(users)
Debug.Print users(l_counter, 1)
Next l_counter
End Sub
Upvotes: 1