• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Show List Of Active Users In Shared Workbook

Hi all,

Is there a code that would display the names of all the people that have a shared workbook open, within the workbook?

We have a document at work that is shared (and each of our names are tied to our log on, so when I go to Shared it shows me the names of who has it open) and I would like to have these peoples names shown in a cell within the workbook.

Ideally without the use of VBA if possible?
__________________________________________________________________
Mod edit : thread moved to appropriate forum !
 
Something this would show with VBA.
It shows time and Usernames.

Code:
Sub Show_Shared()
    Users = ActiveWorkbook.UserStatus
    msg_name = Empty
    For y = 1 To UBound(Users, 1)
        if msg_name <> Empty  then msg_name = msg_name & chr(13)
        msg_name = msg_name & Users(y, 2) & " - " & Users(y, 1)
    Next y
    ans = MsgBox(msg_name, vbInformation, "Users")
End Sub
 
There isn't a way to get user list into worksheet without vba to my knowledge.

For vba code, you can use .UserStatus property of Workbook.
https://msdn.microsoft.com/en-us/library/office/ff193788.aspx

Something like below as quick sample.
Code:
Sub test()
Dim x As Variant
Dim i As Integer
'Change Sheet reference as needed
'Clears Sheet before refreshing with current info
Sheet3.Cells.ClearContents

'Puts data into variant array
x = ThisWorkbook.UserStatus

'Loop through array and puts info into column A
For i = LBound(x, 1) To UBound(x, 1)
    Sheet3.Cells(i, 1).Value = x(i, 1)
Next

End Sub
 
Back
Top