Hi,
How exactly can I get the Active Window tittle text? Example : If I went to www.google.com it would return www.google.com OR if like Notepad is open and active it would say Notepad. I got the script, but I need to extend this to have log created in excel file.
![]()
Option Explicit Private Declare Function GetForegroundWindow Lib "user32" () As Long Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _ (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Private Sub Form_Load() Dim ActiveWindowHandle As Long 'get the handle of the active window ActiveWindowHandle = GetForegroundWindow() Dim Title As String * 255 ' get the title of the active window GetWindowText ActiveWindowHandle, Title, Len(Title) MsgBox Trim(Title) End Sub
Bookmarks