Hi.
My Excel file is located on network drive and I have a macros which automatically exports data from outlook message to excel file.
In case some other user has opened this file I can not run a macros, because file is read only.
There is a KB article "Macro code to check whether a file is already open".
http://support.microsoft.com/kb/291295
My question is:
"How to show username of person who have locked the file?"
E.g.
If IsFileOpen("c:\Book2.xls") Then
' Display a message stating the file in use.
MsgBox "File already in use by: " + username
'
' Add code here to handle case where file is open by another
' user.
'
End if
My Excel file is located on network drive and I have a macros which automatically exports data from outlook message to excel file.
In case some other user has opened this file I can not run a macros, because file is read only.

There is a KB article "Macro code to check whether a file is already open".
http://support.microsoft.com/kb/291295
My question is:
"How to show username of person who have locked the file?"
E.g.
If IsFileOpen("c:\Book2.xls") Then
' Display a message stating the file in use.
MsgBox "File already in use by: " + username
'
' Add code here to handle case where file is open by another
' user.
'
End if