2017-07-27 86 views
1

我想從內部網站信息刮標紅色。由於HTML的複雜性,我不能自己做。VBA Excel數據刮,深HTML

link

我用的是那種代碼但它是不是讓我去比「windowshade體」的一部分更深。

Set myData = IE.Document.getElementById("windowshade").getElementsByClassName("windowshade-body").frames("windowShadeFrame").getElementsByClassName(" ie ie11  win32")(0) 
Text = myData.innerHTML 
Debug.Print Text 

oes任何人都有任何想法如何從這咬一口?感謝任何想法。我在這裏讀了很多主題,但我找不到解決方案。

+0

https://stackoverflow.com/questions/16699267/vba-ie-automation-read-iframe –

回答

1

好的我找到了解決方案。這對我有效。

Set ifrm = IE.Document.getElementsByTagName("iframe")(5).contentDocument.getElementsByTagName("iframe")(0) 
Set text3 = ifrm.contentDocument.getElementsByTagName("tbody")(ifrm.contentDocument.getElementsByTagName("tbody").Length - 1) 
    Set text3 = text3.contentDocument.getElementsByTagName("td")(1) 

CountRows = CInt(Len(text3.outerHTML) - Len(Replace(text3.outerHTML, "iconSmallPaperclipVertical", "")))/26 

MaxVal = Right(Split(text3.outerHTML, "id=" & Chr(34) & "0,")(0), 1) 
For i = 1 To CountRows 

If CDbl(MaxVal) < CDbl(Right(Split(text3.outerHTML, "id=" & Chr(34) & "0,")(0), 1)) Then 
    rowID = Split(Split(text3.outerHTML, "o=" & Chr(34))(1), Chr(34) & ">")(0) 
    MaxVal = Right(Split(text3.outerHTML, "id=" & Chr(34) & "0,")(0), 1) 
End If 
Next i