1
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
我想到這一點,但它給了我的錯誤就看
親愛@mehow我已經試過了,但讓我告訴你在我重新編輯的問題是什麼事 – ExoticBirdsMerchant
@ExoticBirdsMerchant右所以'設置IE =新InternetExplorer' – 2014-02-18 12:28:54
ohhhhhh得到了該死的,我必須打我的頭用的錘子什麼! – ExoticBirdsMerchant