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

Accessing Excel combo box from VB.NET

Posted on 2015-02-23
11
67 Views
Last Modified: 2016-02-12
Trying to figure out how to use vb.net and miscrosoft.office.interop.excel to read the named range from an embedded combo box in excel. I have no clue where to even begin. Any help would greatly be appreciated.
0
Comment
Question by:ProgrammingIsFun
  • 5
  • 4
11 Comments
 
LVL 33

Expert Comment

by:Norie
ID: 40626897
Are you opening the Excel workbook with the combobox?

How was the combobox created and where is it located?
0
 

Author Comment

by:ProgrammingIsFun
ID: 40627250
Hey,
I'm working with the amazon browse tree guide. The embedded combo box comes with the excel spreadsheet from amazon. I am opening up the xls file programmatically and reading the data. One of the columns is an embedded combo box where each has its own named range. I need to find the coordinates of each named range combo box. What should I do?
0
 
LVL 33

Expert Comment

by:Norie
ID: 40627300
If you are working with an Excel workbook there are 2 types of comboboxes you can have on a worksheet - Forms and ActiveX.

You can access a Forms control via the Shapes collection of the sheet and an ActiveX control can be accessed via the OLEOBject collection of the sheet.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:ProgrammingIsFun
ID: 40627344
How can I tell if it's a forms or activex control?
0
 
LVL 33

Expert Comment

by:Norie
ID: 40627350
If you select the combobox and right click you'll see Assign Macro... as an option in the context menu if it's a Forms control, if it's an ActiveX button you'll see Properties (and View Code) as one of the options.
0
 

Author Comment

by:ProgrammingIsFun
ID: 40630283
I have finally figured out that I am not asking the right question.  Let's try again.  I need to read the source (named range) of a data validation list in excel using vb.net .
0
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points
ID: 40630295
It's not really the wrong question, it's more like a different type of dropdown.:)

In VBA we would use this code to get the named range of the data validation of cell A1.
    strName = Range("A1").Validation.Formula1

Open in new window


The code for VB.Net shouldn't look much different.
0
 

Author Comment

by:ProgrammingIsFun
ID: 40631174
Oh, that was perfect.  One more question. How can I determine, using vba, if a cell is a data validation list.  Most of the items in the cells in the column are data validation list are, but a few are not.  Thanks.
0
 
LVL 33

Expert Comment

by:Norie
ID: 40631207
What you could do is use SpecialCells(xlCellTypeAllValidation) for the column.

That should return all the cells in the column that have data validation.

If you want to find cells that have the same validation you can use xlCellTypeSameValidation.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40684226
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

789 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