The following example uses the ActiveWindow property to return the caption of the active window.
Debug.Print Application.VBE.ActiveWindow.Caption