Extract list from Combobox

ExcelChampion

Well-known Member
Joined
Aug 12, 2005
Messages
976
Trying to get the list from a combobox in an online form. I'm doing this as a check to make sure what I need to be there is there. Then the macro will select what I need and move on. If not found in the list, then it will move on...

So I start thinking about it and I'm not quite sure how to do that in Forms. Does ListIndex get me there? Any help is appreciated.

I'm unable to give the site because you'd have to login with a password, but here's the code I have to Set the combobox:

Set PartNumOffr0EDrop = .Document.all.Item("PartNumOffr0EDrop")
myVal = PartNumOffr0EDrop.ListIndex

I need to know how to loop through the combobox and store the value of each member of the list to a variable or cell.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Here are three ways. The bulk array method loads the full 10 column .List, even if you are using a one column listbox. Note that a listbox's .List is a zero based array.

Code:
Dim xVar As Variant, yVar() As String, i As Long
    
    Rem bulk copy to array, note that xVar will be dimmed (0 to .ListCount-1 , 0 to 9)
    xVar = ListBox1.List
    
    Rem looping transfer to array
    With ListBox1
        ReDim yVar(0 To .ListCount - 1)
        For i = 0 To .ListCount - 1
            yVar(i) = .List(i)
        Next i
    End With

    Rem fill a range
    With ListBox1
        Range("A1").Resize(.ListCount, .ColumnCount) = .List
    End With
 
Last edited:
Upvote 0
Thanks. I tried and tried to implement this to extract the list from the dropdown on the web form but no luck.

click and value are the only properties I found that work on this dropdown. So, I can click it, which I need to do to because doing so checks a radio button. I can change the value in the box, but I just can't seem to find the property to tell me what values are in the dropdown.
 
Upvote 0
Is this dropdown on a userform, on a command bar or on a sheet? If on a sheet, is it from the Forms menu or is it an ActiveX control.

Or is this some imbedded object that looks like a MicroSoft dropdown control?
 
Upvote 0
It's in Internet Explorer. I thought if I knew how to do it in Excel I could transfer that to the web form in Internet Explorer, but the properties are not the same. Currently doing a search on the Int Explor object model.
 
Upvote 0
No problem. I learned something from this. I've never had to extract a list from a dropdown, but now I know how to do it in Excel if it ever comes up. ;) Thank you.
 
Upvote 0
Todd

Surely if you are populating the combobox you already have the list somewhere.:eek:

What exactly is 'PartNumOffr0EDrop'?

Mike

I think the OP is trying to get data/whatever from a web page, not from Excel.:)

PS Todd, if it is a web page then it's almost impossible to help without being able to access it.
 
Upvote 0
Norie...TG you are here. You have been the champion of the IE object model...

I'm not trying to populate it, I'm trying to find out what it is already populated with. Once I can do that, then the macro will check to see that the value I want is in the list and populte the dropdown with that value. If not, then the macro will do somehthing else. But, I cannot figure out how to get the list...

I know, if you cannot access it its tough. But you'd need username and password and I'm not at liberty to give that out.

I can SET the object with:

Set PartNumOffr0EDrop = .Document.all.Item("PartNumOffr0EDrop")
PartNumOffr0EDrop.Click
myList = PartNumOffr0EDrop.???

I can click it which must fire code in the page that selects a radio button, which I need. I can populate the dropdown if I already know what the list consists of, but I need to get the list.
 
Last edited:
Upvote 0
"PartNumOffr0EDrop" is the dropdown box.

How about this? How can we extract the list from one of the dropdowns from this site?

http://personals.yahoo.com/;_ylc=X3...3MTYxNDkEc2VjA2ZwLXRyb3VnaARzbGsDcGVyc29uYWxz

Edit: Darn, can't view source from this link...

Edit Edit: Here we go: https://www.dibbs.bsm.dla.mil/

Code:
Sub WebQuery1()

    Set ie = CreateObject("InternetExplorer.Application")
    With ie
        .Visible = True
        
        .navigate "https://www.dibbs.bsm.dla.mil/"
        
        Do Until .readyState = 4: DoEvents: Loop
        Do While .Busy: DoEvents: Loop
        DoEvents

        Set select1 = .Document.all.Item("select1")
        select1.Click

    End With
End Sub

At the top of a page there's a dropdown labelled "Navigation". I beleive it is named select1, which is in the code above. How to extract the list and put into Excel?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,186
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top