【问题标题】:VBA Excel data scrape, deep HTMLVBA Excel 数据抓取,深度 HTML
【发布时间】:2023-03-13 11:20:01
【问题描述】:

我正在尝试从标记为红色的 Intranet 站点信息中抓取。由于 HTML 的复杂性,我无法自己完成。

我使用的是那种代码,但它并没有让我比“windowshade-body”部分更深入。

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

有谁知道如何从中咬一口?将感谢任何想法。我在这里阅读了很多主题,但我找不到解决方案。

【问题讨论】:

标签: excel vba


【解决方案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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-06-16
    • 2016-10-04
    • 1970-01-01
    • 1970-01-01
    • 2021-10-10
    • 2018-03-07
    • 1970-01-01
    相关资源
    最近更新 更多