View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Stefano Gatto Stefano Gatto is offline
external usenet poster
 
Posts: 59
Default How to display the user "locking" a workbook or an addin.

When a user opens a workbook stored on a shared folder, which is already open
by someone else, Excel notifies to the second user the name of the first
user currently "locking" the file. This is quite practical, because it helps
the second user find out who can release the file.

Does someone know if there is a property in Excel's VBA that contains the
name of the first user? I have tried WriteReservedBy, but this actually
returns the name of the second user, not the first user locking the file... I
need to use this property for an XLA, since as you might know, in the case
the file is an XLA, Excel won't warn the second user as it does it for an XLS!

My code (attempt):

If ThisWorkbook.ReadOnly Then
MsgBox _
"The application is currently in use by " & _
ThisWorkbook.WriteReservedBy & _
". Please try later when the application will be released.", _
vbExclamation + vbOKOnly
ThisWorkbook.Close
End
End If

Thank you so much.
--
Stefano Gatto