0

I am trying to extract the data that a javascript tooltip displays, but have no idea how to do it. I thought maybe an XMLHTTP request needs to be sent to the server, but honestly I am not sure. Below is the JS tooltip code to show and hide the tool tip. Is there something else I have to look for other than this to help me get the information that the tooltip shows and put that data in an excel sheet? I really would like some help from beginning to end on this, because I honestly do not know how to start it. Thank you very much.

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

Here is a link below to Mr. Excel, that I posted the question on, but I do no think they understand what I am trying to do. Thank you

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

Alexander O'Mara
  • 58,688
  • 18
  • 163
  • 171

1 Answers1

0

Try something like that to read parent file

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

From Reading HTML file in VBA Excel

Then find anchor tags as shown in code below

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

Parse mouseOverValue to get value of tooltip page and call GetHTML again for tooltip page

Community
  • 1
  • 1
Nasir
  • 207
  • 4
  • 17
  • I do not think that I was specific enough as to where the data can be found. What do I need to do if the data is being pulled from an internal SQL database? Thank you. – Apollo4life Jan 14 '15 at 12:08