Who has a document open?

S

Stephen English

Hi
I am using code below to check for a File Lock. I would like to know who
has the file open. Is there an easy way to get this information please?
Thanks
Stephen

Public Function FileLocked(strFileName As String) As Boolean
On Error Resume Next
' If the file is already opened by another process,
' and the specified type of access is not allowed,
' the Open operation fails and an error occurs.
Open strFileName For Binary Access Write Lock Read As #1
Close #1
' If an error occurs, the document is currently open.
If Err.Number <> 0 Then
FileLocked = True
Err.Clear
End If
End Function
 
S

Stephen English

Thanks Doug - a great help as always
Stephen

Doug Robbins - Word MVP said:
See

http://www.mvps.org/access/modules/mdl0038.htm

or possibly (I haven't bothered looking at the solution - it's a matter of
principle)

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Q_23057105.html


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
Top