Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parse data from Excel to IE using VBA

Status
Not open for further replies.

AdriPaul

Technical User
Apr 9, 2012
1
RO
Dear All,

I am trying to parse some data from an Excel sheet to an IE page using VBA and I have difficulties in sending data to one object that look like a special combobox.

In fact there are 2 comboboxes on that particular page define as following:
- Combobox 1:
<selectname="material[]">
<optionvalue="3">AL</option>
<optionvalue="2">TL</option>
<optionvalue="1">GL</option>

- Combobox 2:
<divclass="ui-widget">
<selectname="partner" id="ID" style="width:300px">
<optionvalue="no"></option>
<optionvalue="3766">COMPANY 1</option>
<optionvalue="3792">COMPANY2</option>
<optionvalue="3764">COMPANY 3</option>
<optionvalue="3071">COMPANY 4</option>

While I can send the data to combobox 1 using the following code:
IE.document.all.Item("material[]").selectedIndex = "2"

it seems that the same code doesn't function on the second combobox:
IE.document.all.Item("partner").selectedIndex = "3766"

and no data is displayed (nor trigger any errors).

Do you have any ideas how could I accomplish this?

Thanks in advance for looking into this,
Adrian

 

After this line of your code:
[tt]
IE.document.all.Item("material[]").selectedIndex = "2"
[/tt]
Which element from the combo is selected in IE?

It may just be that what you do is: give me the second (or 3rd item if it is 0 based)
[tt]
IE.document.all.Item("material[]").selectedIndex = 2
[/tt]

So if you say:
[tt]
IE.document.all.Item("partner").selectedIndex = "3766"
[/tt]
what you do is saying: give me 3766 (or 3765) item from tha list, but there are only 5 items in the list :-(

Just a guess....

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top