Solved

How do I reference an Excel VBA ActiveX control ?

Posted on 2014-11-11
3
274 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
Comment Utility
Simply:
strFileNameYear = Me.coYear.Value

Open in new window

0
 
LVL 45

Assisted Solution

by:Martin Liss
Martin Liss earned 250 total points
Comment Utility
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
Comment Utility
Thanks for two helpful solutions, both. I'll split the points if you don't mind.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

762 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

10 Experts available now in Live!

Get 1:1 Help Now