Option Compare Database
Option Explicit
Public Declare Function MMC_apiGetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lbString As String, ByVal cch As Long) As Long
Public Function MMC_GetWindowText(Optional varWHandle As Variant) As String
Dim lngWHandle As Long
Dim lngNoChars As Long
Dim strText As String
strText = Space(255)
If (IsMissing(varWHandle)) Then
lngWHandle = hWndAccessApp
Else
lngWHandle = varWHandle
End If
lngNoChars = MMC_apiGetWindowText(lngWHandle, strText, Len(strText) - 1)
MMC_GetWindowText = Left(strText, lngNoChars)
End Function