Hi RM
In theory (this demo click the form surface outside controls to run):
Private Sub UserForm_Click()
MsgBox Me.ActiveControl.Name
End Sub
Problems arise when you use containers, frames and multipages, which I
understand youn will. They will be the active control and you have to dig
for THEIR active control. The approach would be like this
Private Sub UserForm_Click()
On Error Resume Next
MsgBox Me.ActiveControl.Name
MsgBox Me.Controls(Me.ActiveControl.Name).ActiveControl.N ame
End Sub
now you decide how many levels deep are needed and which errors to trap if
there are fewer levels when you search. Problem is probably not that big
when you know what this is for and when it's gonna run.
HTH. Best wishes Harald
"Roy Miller " skrev i melding
...
I suspect this is possible to do in VBA but I am at a loose end on how
it is done.
On a userForm that has multiple objects in multiple frames, is it
possible to find out which object at any particular time, irrespective
of which frame it is in, has currently got the focus ?
Any ideas?
Thanks in advance
R M
---
Message posted from http://www.ExcelForum.com/