VBA绑定修改

我试图修改这个由ron提供给我的示例代码

Sub test() Dim IE As Object Set IE = CreateObject("InternetExplorer.Application") my_url = "http://www.google.com" With IE .Visible = True .navigate my_url .Top = 50 .Left = 530 .Height = 400 .Width = 400 Do Until Not IE.Busy And IE.readyState = 4 DoEvents Loop End With ' Find the desired url and click Set Results = IE.document.getElementsByTagName("a") For Each itm In Results If itm.outerhtml = "BAC VII" Then itm.Click Do Until Not IE.Busy And IE.readyState = 4 DoEvents Loop Exit For End If Next End Sub 

现在我不是后期的绑定风扇,所以我想修改前两个语句

 Dim IE As Object Set IE = CreateObject("InternetExplorer.Application") 

并replace它们

 Dim IE As InternetExplorer.Application Set IE = New InternetExplorer.Application 

但是,即使我的Microsoft Internet ControlsMicrosoft HTML Object Library在引用上激活,这在我的代码上也不起作用,如下图所示。

为什么?

在这里输入图像说明

亲爱的mehow

我已经想到了,但它只给我看错误

在这里输入图像说明

 Dim ie As InternetExplorer Set ie = new InternetExplorer 

因为InternetExplorer是类名称

在这里输入图像说明