每次我尝试触发更改事件时,都在ie11中收到脚本70错误

时间:2018-11-11 05:10:32

标签: html excel vba triggers

 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

0 个答案:

没有答案