PerseveringHarold
New Member
- Joined
- May 23, 2023
- Messages
- 10
- Office Version
- 365
- Platform
- Windows
I've written a macro for an Excel-based data tool at work, stored on a shared drive. The macro runs successfully for me and another colleague, but two other colleague's that have tested it encounter a 'Runtime Error 53 - File not found'. We're all using different machines accessing the shared drive remotely.
When the macro runs, it checks to see if another file is open first, then copies data from that file into the macro's workbook. But the check is only for an open workbook using a specific filename, no file path is included. Debugging the error highlights one of the Err lines in the Function code for checking whether the other file is open (can't remember right now if it highlights
or
I've been through one of the colleague's macro & VBA security settings, they appear to match mine. We're running the same version of VBA. They have the same Microsoft Office Object Library ticked in the References.
I'm stuck and rather hoping for help. Thanks.
When the macro runs, it checks to see if another file is open first, then copies data from that file into the macro's workbook. But the check is only for an open workbook using a specific filename, no file path is included. Debugging the error highlights one of the Err lines in the Function code for checking whether the other file is open (can't remember right now if it highlights
Code:
Err No = Err
Code:
Case Else: Error ErrNo
VBA Code:
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
I've been through one of the colleague's macro & VBA security settings, they appear to match mine. We're running the same version of VBA. They have the same Microsoft Office Object Library ticked in the References.
I'm stuck and rather hoping for help. Thanks.