Skip to content

Instantly share code, notes, and snippets.

@ndthanh
Created February 19, 2017 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndthanh/85e101d7972bf00dd9ce15c4411987af to your computer and use it in GitHub Desktop.
Save ndthanh/85e101d7972bf00dd9ce15c4411987af to your computer and use it in GitHub Desktop.
Function IsWorkBookOpen(FileName As String)
Dim ff As Long, ErrNo As Long
On Error Resume Next
ff = FreeFile()
Open FileName For Input Lock Read As #ff
Close ff
ErrNo = Err
On Error GoTo 0
Select Case ErrNo
Case 0: IsWorkBookOpen = False
Case 70: IsWorkBookOpen = True
Case Else: Error ErrNo
End Select
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment