Created
February 19, 2017 06:14
-
-
Save ndthanh/85e101d7972bf00dd9ce15c4411987af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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