I put a bunch of controls on a userform, then used this code to display the
activecontrol's name:
Option Explicit
Private Sub CommandButton1_Click()
MsgBox Me.ActiveControl.Name
End Sub
Private Sub UserForm_Initialize()
With Me.CommandButton1
.TakeFocusOnClick = False
End With
End Sub
Thanks Dave. This is exactly what I need. In the future I have to pay more
attention to the PROPERTY/METHOD list that drops down after typing the
period. It shows the ActiveControl property there but it doesn't show it in
the Property Window(where I normally look).
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.