Solved

How do I reference an Excel VBA ActiveX control ?

Posted on 2014-11-11
3
324 Views
Last Modified: 2014-11-12
Hi All,

I have an Excel sheet with an ActiveX combo box named coYear. However, when I try to refer to it in my VBA procedure I get the following error message : Compile error. Method or data member not found

I'm trying to load a variable called strFileNameYear from this control object as follows:

strFileNameYear = Me.Controls("coYear").Value

What am I doing wrong ?

Thanks
Toco
0
Comment
Question by:Tocogroup
3 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 250 total points
ID: 40435389
Simply:
strFileNameYear = Me.coYear.Value

Open in new window

0
 
LVL 46

Assisted Solution

by:Martin Liss
Martin Liss earned 250 total points
ID: 40435432
You really should't use ActiveX controls on a sheet. If you do you may find that they change size and/or font size on their own.
0
 

Author Closing Comment

by:Tocogroup
ID: 40436816
Thanks for two helpful solutions, both. I'll split the points if you don't mind.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now