Integrating browser with excel

M

Maxi

Thank you so much

If you need a general-purpose function then maybe something like this
(untested)

example useage:
debug.print GetValue(IE.document, "Report Owner")

'********************************
'Find text in the first cell of a table row and
' return the text in the next cell to the right
Function GetValue(doc As Object, sValueType As String) As String
Dim t As Object, retVal As String
Dim r As Integer

retVal = ""
For Each t In doc.getElementsByTagName("TABLE")
For r = 0 To t.Rows.Length - 1
If t.Rows(r).Cells(0).innerText = sValueType Then
retVal = t.Rows(r).Cells(1).innerText
Exit For
End If
Next r
If retVal <> "" Then Exit For
Next t

GetValue = retVal

End Function
'********************************

Note you don't need to copy the value to the clipboard:

Activesheet.range("A1").value = GetValue(IE.document, "Report Owner")

Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top