Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VBA obtaining active object name

Posted on 2007-03-17
3
Medium Priority
?
2,058 Views
Last Modified: 2013-12-20
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
0
Comment
Question by:ryan_uk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 48

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 18741972
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
0
 

Author Comment

by:ryan_uk
ID: 18746966
Hi Wayne,

Thanks for your reply.

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

Horrible limitations with VBA :(

Ryan

0
 
LVL 48

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 150 total points
ID: 18751842
Ryan,

It's true that intellisense doesn't show it, but have you tried my example? It does work in VBA. SelectedItem is a property of MultiPage, so will work in this example.

Wayne
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question