vba控制html的select点击,VBA html option select and input

I´m completely new at working with VBA and html and I hope someone could help me.

In the website that I need to get information there´s a dropdown list and an input box which changes according to the option selected in the droplist.

With my VBA I´m able to make the dropdown list option change, but the input box wont change, it stays the same as the default option.

This is the code I´m running

Dim ie As New SHDocVw.InternetExplorer

Dim HTMLDoc As MSHTML.HTMLDocument

Dim HMTLInputs As MSHTML.IHTMLElementCollection

Dim HTMLInput As MSHTML.IHTMLElement

ie.Visible = True

ie.navigate "myURL"

Do While ie.readyState <> READYSTATE_COMPLETE

Loop

Set HTMLDoc = ie.document

HTMLDoc.getElementById("zkComp62").Click

HTMLDoc.getElementById("zkComp66").Click

Set seleccion = HTMLDoc.getElementById("zkComp118")

seleccion.selectedIndex = 3

and this is the hmtl code that I get from the website if I run the code

Buscar por:

Fecha de activación

Cliente

No. de Cliente

Contrato

Estatus

Distribuidor

Inicio:

Fin:

But if I manually click on the option that I need in the website, the last td in the code changes and looks like this

Buscar por:

Fecha de activación

Cliente

No. de Cliente

Contrato

Estatus

Distribuidor

I´ve looked in other answers but I cant find something that works for my code.

I´ve already tried with FireEvent but I doesn´t change anything and also with getelementsbyID("").focus but still I can´t make it work.

Thanks

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值