Vba Get Activate Window Name

[Solved] Vba Get Activate Window Name | Vb - Code Explorer | yomemimo.com
Question : vba get activate window name

Answered by : sonic-go

Public Declare Function GetForegroundWindow Lib "user32" _ Alias "GetForegroundWindow" () As Long
Public Declare Function GetWindowText Lib "user32" _ Alias "GetWindowTextA" (ByVal hwnd As Long, _ ByVal lpString As String, ByVal cch As Long) As Long
Sub AAA() Dim WinText As String Dim HWnd As Long Dim L As Long HWnd = GetForegroundWindow() WinText = String(255, vbNullChar) L = GetWindowText(HWnd, WinText, 255) WinText = Left(WinText, InStr(1, WinText, vbNullChar) - 1) Debug.Print L, WinText
End Sub

Source : https://stackoverflow.com/questions/27747361/vba-code-to-read-the-active-program | Last Update : Thu, 26 May 22

Answers related to vba get activate window name

Code Explorer Popular Question For Vb