Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Accessing Excel combo box from VB.NET

Posted on 2015-02-23
11
Medium Priority
?
73 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
10 Comments
 
LVL 35

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 35

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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

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

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 35

Accepted Solution

by:
Norie earned 2000 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 35

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 49

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Ever wonder what it's like to get hit by ransomware? "Tom" gives you all the dirty details first-hand – and conveys the hard lessons his company learned in the aftermath.
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

876 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