ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel shared file (https://www.excelbanter.com/excel-programming/283343-excel-shared-file.html)

Gabriel[_3_]

Excel shared file
 
Is there any way to getting a list (with the help of VBA) of who is
opening an excel shared file ?


Thank you

Michel Pierron

Excel shared file
 
Hi Gabriel;

Private Sub UsersList()
Dim users, msg As String, status As String
users = ThisWorkbook.UserStatus
For Row = 1 To UBound(users, 1)
msg = msg & users(Row, 1) & " " & Format(users(Row, 2), "dd/mm/yy h:mm")
& " "
If users(Row, 3) = 1 Then status = "(Exclusive mode)" Else status =
"(Shared mode)"
msg = msg & status & vbLf
Next
MsgBox msg, 64
End Sub

MP

"Gabriel" a écrit dans le message de
om...
Is there any way to getting a list (with the help of VBA) of who is
opening an excel shared file ?


Thank you




Matteo[_3_]

Excel shared file
 
Michel ... UserStatus property is the good one but unfortunately is not useful if you have to open the file as read-only. So back to square one: if you want to trap an error (e.g. trying to save a file that is already open by someone else) you have to use something else and I don't know what to do

----- Michel Pierron wrote: ----

Hi Gabriel

Private Sub UsersList(
Dim users, msg As String, status As Strin
users = ThisWorkbook.UserStatu
For Row = 1 To UBound(users, 1
msg = msg & users(Row, 1) & " " & Format(users(Row, 2), "dd/mm/yy h:mm"
& "
If users(Row, 3) = 1 Then status = "(Exclusive mode)" Else status
"(Shared mode)
msg = msg & status & vbL
Nex
MsgBox msg, 6
End Su

M

"Gabriel" a écrit dans le message d
om..
Is there any way to getting a list (with the help of VBA) of who i
opening an excel shared file
Thank yo






All times are GMT +1. The time now is 12:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com