我想從網站下載一些數據,點擊後開始下載。 但此代碼無法正常工作,任何人都可以幫忙。使用VBA的數據報廢從網站
Dim ie As InternetExplorer
Dim htmldoc As MSHTML.IHTMLDocument
Dim HTMLInput As MSHTML.IHTMLElementCollection
Dim HTMLAs As MSHTML.IHTMLElementCollection
Dim HTMLA As MSHTML.IHTMLElement
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
'Navigate to webpage
Dim ieURL As String: ieURL = "http://erldc.org/final-schedule.aspx"
ie.navigate ieURL
Do While ie.readyState <> READYSTATE_COMPLETE
Loop
Set htmldoc = ie.document
Set HTMLInput = htmldoc.getElementsByTagName("a")
For Each HTMLA In HTMLAs
Debug.Print HTMLA.getAttribute( 「類名」),HTMLA.getAttribute(的 「href」),HTMLA.getAttribute( 「相對」)
If HTMLA.getAttribute("href") = "javascript:__doPostBack('ctl00$ContentPlaceHolder1$Calendar1','6420')" Then
HTMLA.Click
Exit For
End If
Next HTMLA
結束子
非常感謝讓論壇知道這一點。 – cyboashu
@cyboashu你能幫我下載1個月的數據嗎?我沒有得到合適的結果。 –