You can try this version --


You have a "*" in your filename after the "" to look for. Do you really need it?

        P & "\*" & KW & "*.xls*" Then

Seems to me that this would be better if you can use it

        P & "\" & KW & "*.xls*" Then
This would find "C:\Users\Tom\Documents\MTO Sales.xls" but not

"C:\Users\Tom\Documents\2020-01-25 MTO Sales.xls" or "C:\Users\Tom\Documents\2020-06-01 MTO Sales.xls"



Option Explicit


Private Function OpenTheFile(P As String, KW As String) As Workbook
    Dim strFile As String
    Dim wb As Workbook
    
    Set OpenTheFile = Nothing
    
    For Each wb In Application.Workbooks
        If wb.FullName Like P & "\*" & KW & "*.xls*" Then
            wb.Close False
            MsgBox "Workbook :- " & KW & " was already open " & P, vbCritical, "Select Correct Date or Check Files in A Folder"
            Set OpenTheFile = Nothing
            Exit Function
        End If
    Next
    
    
    strFile = Dir(P & "\*" & KW & "*.xls*")
    If strFile <> "" Then
        Application.DisplayAlerts = False
        Set OpenTheFile = Workbooks.Open(P & Application.PathSeparator & strFile, False, True)
        Application.DisplayAlerts = True
        Exit Function
    End If
        
    MsgBox "Workbook :- " & KW & " not found in a Folder " & P, vbCritical, "Select Correct Date or Check Files in A Folder"
End Function