2017-07-27 138 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