0
我無法使用span
標記並抓取「1日全部返回」的內部文本。刮'span'標記不起作用
這裏是網頁:
http://www.morningstar.com/funds/XNAS/DODFX/quote.html
這裏是我的代碼
Sub Macro1()
'
link = "http://www.morningstar.com/funds/XNAS/DODFX/quote.html"
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = True
.navigate link
Do
DoEvents
Loop Until ie.readyState = READYSTATE_COMPLETE
Dim doc As HTMLDocument
Set doc = ie.document
While ie.readyState <> 4
Wend
On Error Resume Next
Application.Wait (Now + TimeValue("00:00:02"))
range("B5").Offset(0, 0).Value = doc.getElementById("msqt_summary")(0).getElementsByClassName("gr_colm_a2b")(0).getElementsByTagName("span")(0).innerText
End With
ie.Quit
Application.EnableEvents = True
'
End Sub
iframe是在頁面中。這是一個問題。 – MacroMarc
這是一個url(包含完全相同的項目),你應該試着用iframe來獲取你的內容:http://quotes.morningstar.com/fund/fundquote/f?t=DODFX&culture=en_us&platform=RET&viewId1= 2313453521&viewId2 = 3167723247&viewId3 = 3474403256&測試= QuoteiFrame – SIM