Dim htl As MSHTML.HTMLDocument
“启动IE对象
Set IE = CreateObject("InternetExplorer.Application")
“转到网页
IE.Navigate VendorHome
'等待页面加载的Sub
Call Load
“创建事件”
Set htl = IE.document.createEvent("HTMLevents")
htl.initEvent "change", False, True
'选择下拉框
SelectOpt.Click
'在下拉菜单中选择选项
For Each opt In SelectOpt
If opt.Text = "Purchase order number" Then
SelectOpt.ChildNodes(3).Selected = True
SelectOpt.Options(1).Selected = True
SelectOpt.selectedIndex = 1
' SelectOpt.dispatchEvent (htl) ' Error is Received on this Line
End If
Next