Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
Private Declare PtrSafe Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal HWND As LongPtr, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare PtrSafe Function GetWindow Lib "user32" (ByVal HWND As LongPtr, ByVal wCmd As Long) As Long
Function FindWindowByPartTitle(Optional partTittle As String)
Dim sStr As String, HWND As LongPtr
sStr = Space$(150)
HWND = FindWindow(vbNullString, vbNullString)
Do While HWND <> 0
GetWindowText HWND, sStr, 300
If Lcase()"x" & Trim(sStr) & "x") Like "*" & Lcase(partTittle) & "*" Then
FindWindowByPartTitle = HWND
Exit Do
End If
HWND = GetWindow(HWND, 2)
Loop
End Function