VBA 在 Javascript 工具提示中看到数据

VBA getting data seen in Javascript tooltip

我正在尝试提取 javascript 工具提示显示的数据,但不知道该怎么做。我想也许需要将 XMLHTTP 请求发送到服务器,但老实说我不确定。下面是显示和隐藏工具提示的 JS 工具提示代码。除了这个我还需要寻找其他东西来帮助我获取工具提示显示的信息并将该数据放入 excel 工作表中吗?我真的很想从头到尾得到一些帮助,因为老实说我不知道​​如何开始。非常感谢。

< a href="javascript:gotopage('D35555')" on mouse over="ajax_showTooltip('D35555','DATA_PAGE',this);return false" on mouse out="ajax_hideTooltip()" >

下面是给 Excel 先生的 link,我在上面发布了问题,但我认为他们不理解我正在尝试做什么。谢谢

http://www.mrexcel.com/forum/excel-questions/827332-parsing-javascript-%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A-text.html

尝试类似的方法来读取父文件

Function GetHTML(URL As String) As String
    Dim HTML As String
    With CreateObject("MSXML2.XMLHTTP")
        .Open "GET", URL, False
        .Send
        GetHTML = .ResponseText
    End With
End Function

来自Reading HTML file in VBA Excel

然后找到如下代码所示的锚标签

Private Sub SomeMethod()

   Dim URL As String, Result As String
    URL = "http://localhost/ajax-tooltip/ajax-tooltip.html"

   Result = GetHTML(URL)

    Dim Document As Object
    Set Document = New HTMLDocument
    Dim HTMLElement As IHTMLElement

    Document.Open
    Document.write Result
    Document.Close

    Dim ElementCollection As IHTMLElementCollection
    Set ElementCollection = Document.getElementsByTagName("a")

Dim mouseOverValue As String

For Each HTMLElement In ElementCollection


    If Not IsNull(HTMLElement.getAttribute("onmouseover")) Then
        mouseOverValue = HTMLElement.getAttribute("onmouseover")
        If InStr(mouseOverValue, "ajax_showTooltip") Then
            MsgBox ("Find your page here and read its HTML: " + mouseOverValue)
        End If
    End If

Next HTMLElement

End Sub

解析 mouseOverValue 以获取工具提示页面的值并为工具提示页面再次调用 GetHTML