Here is the code:
a potential url would be:
"http://tradingroom.com .au/apps/qt/quote.ac?sectio n=quotedetail&s y=tpl&type=dela yedquote&code=B HP"
Function TradingRoomGetQ uoteData(ByVal sWS As String) As Boolean
Dim oMSHTML As MSHTML.HTMLDocu ment
Dim oHTMLDoc As MSHTML.HTMLDocu ment
Dim oDataTable As MSHTML.HTMLTabl e
Dim oWebTables As Object
Dim oWB As Workbook
Dim oWSCompanyList As Worksheet
Dim sQuoteQuery As String
Dim sTableData As String
Dim sASXCodes As String
Dim sURL As String
Dim iLastCompanyRow As Integer
Dim iCompanyRow As Integer
Dim iTableRow As Integer
Dim iTableCell As Integer
Dim bFoundLast As Boolean, bFoundYield As Boolean, bFoundCap As Boolean
Set oMSHTML = New MSHTML.HTMLDocu ment
Set oWB = ActiveWorkbook
Set oWSCompanyList = oWB.Worksheets( sWS)
sURL =
"http://tradingroom.com .au/apps/qt/quote.ac?sectio n=quotedetail&s y=tpl&type=dela yedquote&code="
iLastCompanyRow = oWSCompanyList. Cells.SpecialCe lls(xlLastCell) .Row - 1
iCompanyRow = ASXLIST_OFFSET
Do While iCompanyRow <= iLastCompanyRow
sASXCodes = oWSCompanyList. Cells(iCompanyR ow, 2).Value
'sQuoteQuery = sURL & "BHP"
sQuoteQuery = sURL & sASXCodes
Set oHTMLDoc = oMSHTML.createD ocumentFromUrl( sQuoteQuery,
vbNullString)
While oHTMLDoc.readyS tate <> "complete"
DoEvents
Wend
With oHTMLDoc.docume ntElement
Set oWebTables = .all.tags("tabl e")
Debug.Print sASXCodes
bFoundLast = False
bFoundYield = False
bFoundCap = False
For Each oDataTable In oWebTables
For iTableCell = 0 To oDataTable.Cell s.Length - 1
sTableData = Trim(oDataTable .Cells(iTableCe ll).innerText)
'Debug.Print iTableCell; sTableData
Select Case sTableData
Case "Closing Price"
Debug.Print
oDataTable.Cell s(iTableCell).i nnerText; ":"; oDataTable.Cell s(iTableCell +
6).innerText
bFoundLast = True
Exit For
Case "Div Yield"
Debug.Print
oDataTable.Cell s(iTableCell).i nnerText; ":"; oDataTable.Cell s(iTableCell +
5).innerText
bFoundYield = True
Exit For
Case "Market Capitalisation"
Debug.Print
oDataTable.Cell s(iTableCell).i nnerText; ":"; oDataTable.Cell s(iTableCell +
1).innerText
bFoundCap = True
Exit For
End Select
Next
If bFoundLast And bFoundYield And bFoundCap Then Exit For
Next
End With
iCompanyRow = iCompanyRow + 1
Loop
End Function
"Cor Ligthert" wrote:
Jack,
First that I answer in this is forever,
Ineternet Explorer gets a Page not a document.
A page can exist from more documents.
The mshtml.createDo cumentFromUrl, gets a document.
So to get a good answer I think that you have to show us at least the page
where you are talking about.
I hope this helps?
Cor