ryan_uk
asked on
VBA obtaining active object name
Hello all,
In VBA I am trying to find a way to call the name of the active object within the form.
Me.ActiveControl works for most part however if I have a multipage or tabstrip within the form the ActiveControl returned is always the multipage/tabstrip name, not the object contained within it.
So if I am trying to call the name of TextBox1 within MultiPage1 how would I do this?
Ryan
In VBA I am trying to find a way to call the name of the active object within the form.
Me.ActiveControl works for most part however if I have a multipage or tabstrip within the form the ActiveControl returned is always the multipage/tabstrip name, not the object contained within it.
So if I am trying to call the name of TextBox1 within MultiPage1 how would I do this?
Ryan
ASKER
Hi Wayne,
Thanks for your reply.
VBA doesn't use ActiveControl.SelectedItem is this a standard VB function?
Horrible limitations with VBA :(
Ryan
Thanks for your reply.
VBA doesn't use ActiveControl.SelectedItem
Horrible limitations with VBA :(
Ryan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try this....
Dim ActCtrl As String
If LCase(ActiveControl.Name) Like "multipage*" Then
Dim pg As Page
Set pg = ActiveControl.SelectedItem
ActCtrl = pg.ActiveControl.Name
Else
ActCtrl = ActiveControl.Name
End If
MsgBox ActCtrl
Regards,
Wayne