R
rhb919
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.
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.