I am getting this Error 75 while using the below IsFileOpen function I had found on one of the forums.
I was not getting this error earlier. Can't figure out what is triggering this error now.
Request expert advise on how to handle it.

Function IsFileOpen(filename As String)
    Dim filenum As Integer, errnum As Integer

    On Error Resume Next   ' Turn error checking off.
    filenum = FreeFile()   ' Get a free file number.
    ' Attempt to open the file and lock it.
    Open filename For Input Lock Read As #filenum
    Close filenum          ' Close the file.
    errnum = Err           ' Save the error number that occurred.
    On Error GoTo 0        ' Turn error checking back on.

    ' Check to see which error occurred.
    Select Case errnum

        ' No error occurred.
        ' File is NOT already open by another user.
        Case 0
         IsFileOpen = False

        ' Error number for "Permission Denied."
        ' File is already opened by another user.
        Case 70
            IsFileOpen = True

        ' Another error occurred.
        Case Else
            Error errnum
    End Select

End Function
The part of my code from it gets called is below

    Dim NewBk As Workbook
    Dim FileNameOnly As String
    
'...... some code...

    'If DataFilePath exists open the file ELSE Make a New DataFile
    If Me.chkUsingPrevFile Then   'a checkbox to indicate if this file was made earlier
        If IsFileOpen(Me.tbDataFilePath) Then
            FileNameOnly = Dir(Me.tbDataFilePath)
            Set NewBk = Workbooks(FileNameOnly)
        Else
            Set NewBk = Workbooks.Open(Me.tbDataFilePath)
        End If
    Else...