ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get name of user who has a file open or checked out from a Sharepoint (https://www.excelbanter.com/excel-programming/445392-get-name-user-who-has-file-open-checked-out-sharepoint.html)

[email protected]

Get name of user who has a file open or checked out from a Sharepoint
 
I have a file that lives on a SP, that multiple users access through a
URL (in other words they don't use "check out" they just click the
URL).

I want a routine to run when they open the file that checks if the
file is in use (in which case it will have opened automatically a read-
only, it would seem). If it is in use, I want to return the name of
the user that has it open.

So far I have:

--------------------------
myPath = ActiveWorkbook.Path
myName = ActiveWorkbook.Name

myUser = ActiveWorkbook.WriteReservedBy

myFile = myPath & "\" & myName


If Workbooks.CanCheckOut(myFile) = False Then 'assume is out with some
other user
MsgBox "File is in use by " & myUser, vbExclamation + vbOKOnly,
ActiveWorkbook.Name
End If
-------------------------------
My problem is the "WriteReservedBy" property doesn't seem to give me
what I want. Even though the file is loaded by me as read-only, it
still gives my name instead of the real user who has that file open.

This is driving me crazy - i've searched everywhere. Any ideas?

Many thanks in advance.





All times are GMT +1. The time now is 09:57 AM.

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