MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Sharing a Workbook


Posted by Pedro Gonçalves on April 19, 2001 9:51 AM

How can I know (from VB) if a workbook is opened by another user in a network?


Posted by Dax on April 19, 2001 11:23 AM

You can do this using something like this. However, it won't display users who have opened the shared workbook as read-only.

Sub DisplayUsers()
'Displays a list of all users who
' currently have this workbook open
Dim Msg As String, CurrentUsers As Variant

CurrentUsers = ThisWorkbook.UserStatus
For c = 1 To UBound(CurrentUsers, 1)
Msg = Msg & CurrentUsers(c, 1) & vbCrLf
Next c

MsgBox Msg

End Sub

Hope this helps,
Dax.