Quote:
Originally Posted by Hdata
I created a command button on the userform and attached the code below:
Code:
Private Sub cmdTextBoxName_Enter()
MsgBox Me.ActiveControl.Name
End Sub
What I received back was
"cmdTextBoxName"
The name of the textbox is actually "Document_City"
What am I missing?
|
Well, your sub's name (cmdTextBoxName_Enter) shows that the control's name can only be 'cmdTextBoxName'. Evidently, you want something else; perhaps the name of a visually-related label. If so, unless the label and control are grouped (and nothing else is in the same group), there is no 100% reliable way for VBA to identify which one you want.