Dans les déclarations du module:
‘—————Détermination de l’appli qui a le focus. Sert à ne pas donner le focus intempestivement
Global App_hwnd As Long
Global App_Title As String
Public Declare Function GetWindowText Lib « user32.dll » Alias « GetWindowTextA » (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetWindowTextLength Lib « user32 » Alias « GetWindowTextLengthA » (ByVal hwnd As Long) As Long
Public Declare Function GetForegroundWindow Lib « user32.dll » () As Long

La fonction qui va bien:
Function RecupereAppliFocus() As String
    Dim MonEntree As String, MaPoignee As Long, MonTexte As String
    Dim hWndlength As Long, hWndTitle As String, returnvalue As Long    

    MaPoignee = GetForegroundWindow
    hWndlength = 255    ‘GetWindowTextLength(MaPoignee)
    hWndTitle = String$(hWndlength, 0)
    returnvalue = GetWindowText(MaPoignee, hWndTitle, (hWndlength + 1))
    RecupereAppliFocus = Replace(hWndTitle, Chr(0), «  »)
End Function