Is workbook open anywhere on network

Function to check if workbook is open anywhere on the network.
Returns a boolean value.
Author: michael@excelexperts.co.uk

Function IsWorkBookOpenOnNetwork(FullPathAndFileName As String)

    Dim ff As Long
    Dim ErrNo As Long

    On Error Resume Next
    ff = FreeFile()
    Open FullPathAndFileName For Input Lock Read As #ff
    Close ff
    ErrNo = Err
    On Error GoTo 0

    Select Case ErrNo
    Case 0: IsWorkBookOpenOnNetwork = False
    Case 70: IsWorkBookOpenOnNetwork = True
    Case Else: Error ErrNo
    End Select

End Function

Address

Brookfield,
55 Heath Drive
Brookwood, Surrey
GU24 0HQ England

Scroll to Top