这是我写的一段代码。
Dim objIE As SHDocVw.InternetExplorer 'microsoft internet controls (shdocvw.dll)
Dim htmlDoc As MSHTML.HTMLDocument 'Microsoft HTML Object Library
Dim htmlInput As MSHTML.HTMLInputElement
Dim htmlColl As MSHTML.IHTMLElementCollection
Dim the_input_elements As MSHTML.IHTMLElementCollection
Dim input_element As MSHTML.HTMLInputElement
Dim IeDoc As MSHTML.HTMLDocument
Dim ie As MSHTML.HTMLDocument
Dim ie3 As MSHTML.HTMLDocument 'Dont forget to remove this
Dim ie2 As MSHTML.HTMLDocument 'To remove
Dim input_element2 As MSHTML.HTMLInputElement
Dim the_input_elements2 As MSHTML.IHTMLElementCollection
Dim objShell As Object 'CHECK MAYBE HERE IS THE ERROR. CHANGE FROM OBJECT TO SHELL??
Dim IE_count As Variant
Dim objShell3 As Object
Dim objShell2 As Object 'Dont forget to remove this at the end.
Dim my_url As Variant
Dim my_title As Variant 'Tp remove
Dim my_title2 As Variant 'To remove
Dim my_title3 As Variant 'To remove
Dim x As Variant
Dim element As HTMLObjectElement
Sub Press_Button1()
Set objIE = New SHDocVw.InternetExplorer
With objIE
.Navigate "microsoft-edge:https://www.ndexsystems.com/fengine/fullservice/en/kerrfinancialsalogin.go?fromLogoff=true" ' Main page
.Visible = 1
'Do While .readyState <> 4: DoEvents: Loop
Application.Wait (Now + TimeValue("0:00:02"))
是否可以将所有这些代码从在Internet Explorer上运行切换到Microsoft Edge?我没有改变上面声明的变量的数据类型的问题。
感谢您的协助!
答案 0 :(得分:2)
Edge中没有ActiveX或COM支持。它没有VBA可以使用的API。
由于安全原因,Microsoft删除了MS Edge中对ActiveX控件的支持。我建议您检查Web驱动程序。 WebDriver是一个远程控制界面,可以对用户代理进行自省和控制。它提供了与平台和语言无关的有线协议,作为进程外程序远程指示Web浏览器行为的一种方式。请参见WebDriver和Bringing automated testing to Microsoft Edge through WebDriver。