用screen,下面为帮助里的原代码,还是帮助好用 Sub ActiveObjects() Dim frm As Form, ctl As Control
' 返回指向活动窗体的 Form 对象。 Set frm = Screen.ActiveForm MsgBox frm.Name & " is the active form." ' 返回指向活动控件的 Control 对象。 Set ctl = Screen.ActiveControl MsgBox ctl.Name & " is the active control " _ & "on this form." End Sub
用screen,下面为帮助里的原代码,还是帮助好用
Sub ActiveObjects()
Dim frm As Form, ctl As Control
' 返回指向活动窗体的 Form 对象。
Set frm = Screen.ActiveForm
MsgBox frm.Name & " is the active form."
' 返回指向活动控件的 Control 对象。
Set ctl = Screen.ActiveControl
MsgBox ctl.Name & " is the active control " _
& "on this form."
End Sub