make selection in listbox html with vba

Jan 26, 2015
Reaction score
This is my first post

I have to make a selection in a listbox which is on a web page with
VBA. I have the beginning of the code :

Sub extractTablesData()
'we define the essential variables

Dim IE As Object,

Set IE = CreateObject("InternetExplorer.Application")

With IE

.Visible = True
.navigate ("")

While IE.ReadyState <> 4

.Document.all ("P2")
.Document.all("P2").selectedIndex = Venta

End Sub

the problem is that i don´t get the code to select the object i want from the list

this is the lnk to the web page:

where it says "tipo de tasa" i want to select "Venta" from vba code

and this is the sourse frm the web page:

<select name="P2" onchange="javascript:pTPageChanged('o:go~r:report~v:compoundView!1~v:pivotTableView!1',this.options[this.selectedIndex].value)">
<option value="1 0" selected="">Compra</option>
<option value="1 1">Media</option>
<option value="1 2">Venta</option>

Thanks for your help it's very important.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question