我试图修改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 = "B.A.C. 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")
并用
替换它们Dim IE As InternetExplorer.Application
Set IE = New InternetExplorer.Application
但是,即使我在参考文件中激活了Microsoft Internet Controls
和Microsoft HTML Object Library
,这对我的代码也不起作用,如下图所示。
为什么?
亲爱的mehow
我已经想到了这个,但它只是让我看错了
答案 0 :(得分:2)
Dim ie As InternetExplorer
Set ie = new InternetExplorer
因为InternetExplorer
是班级名称