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
Solved

How do I reference an Excel VBA ActiveX control ?

Posted on 2014-11-11
3
339 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
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…

856 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