The following example uses the Screen object to print the name of the form in the active window and of the active control on that form:
Sub ActiveObjects()
Dim frm As Form, ctl As Control
' Return Form object pointing to active form.
Set frm = Screen.ActiveForm
MsgBox frm.Name & " is the active form."
' Return Control object pointing to active control.
Set ctl = Screen.ActiveControl
MsgBox ctl.Name & " is the active control " _
& "on this form."
End Sub