Link to home
Start Free TrialLog in
Avatar of ryan_uk
ryan_ukFlag for United Kingdom of Great Britain and Northern Ireland

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
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Hi Ryan,

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
Avatar of ryan_uk

ASKER

Hi Wayne,

Thanks for your reply.

VBA doesn't use ActiveControl.SelectedItem is this a standard VB function?

Horrible limitations with VBA :(

Ryan

ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial