I am trying to fill in a form on a website using VBA.
我正在尝试用VBA在网站上填写表格。
Problem: The problem is that in the webpage the comboboxes are linked for example if I select a value in the first combobox manually then it activates the next one (which is otherwise greyed out). However, when I try to fill values in the comboboxes using vba in the last line of the below code, the next combobox is still greyed out / inactive. Please help.
问题:问题是,在网页中,combobox是链接的,例如,如果我在第一个combobox中手动选择一个值,那么它就会激活下一个(否则会变灰)。但是,当我在下面代码的最后一行使用vba在combobox中填充值时,下一个combobox仍然是灰色的/不活动的。请帮助。
Sub newabc()
Dim ie As Object
Set ie = CreateObject("internetexplorer.application")
ie.Visible = True
ie.navigate "URL"
While ie.Busy
DoEvents
Wend
ie.Document.getelementbyid("USER").Value = "username"
ie.Document.getelementbyid("PASSWORD").Value = "password"
ie.Document.all("Submit").Click
While ie.Busy
DoEvents
Wend
ie.navigate "tab"
While ie.Busy
DoEvents
Wend
ie.Document.all("new").Click
While ie.Busy
DoEvents
Wend
ie.Document.all("j_id0:frm:jobTrackerPageBlock0:startflds1:repeat5:1:inputField").Value = "Media Payables"
'problem occurs here as the next combo box stays inactive.
1 个解决方案
#1
1
Perfect
完美的
ie.Document.all("elementID").onchange
did the trick. Thank you. I have been trying to figure this out for quite sometime now. Thanks a ton Axel Richter.
ie.Document.all(“elementID”)。onchange起了作用。谢谢你!我想弄清楚这件事已经有一段时间了。谢谢你,阿克塞尔·里希特。
#1
1
Perfect
完美的
ie.Document.all("elementID").onchange
did the trick. Thank you. I have been trying to figure this out for quite sometime now. Thanks a ton Axel Richter.
ie.Document.all(“elementID”)。onchange起了作用。谢谢你!我想弄清楚这件事已经有一段时间了。谢谢你,阿克塞尔·里希特。