Here is the code:
a potential url would be:
"http://tradingroom.com.au/apps/qt/quote.ac?section=quotedetail&sy=tpl&type=delayedqu ote&code=BHP"
Function TradingRoomGetQuoteData(ByVal sWS As String) As Boolean
Dim oMSHTML As MSHTML.HTMLDocument
Dim oHTMLDoc As MSHTML.HTMLDocument
Dim oDataTable As MSHTML.HTMLTable
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.HTMLDocument
Set oWB = ActiveWorkbook
Set oWSCompanyList = oWB.Worksheets(sWS)
sURL =
"http://tradingroom.com.au/apps/qt/quote.ac?section=quotedetail&sy=tpl&type=delayedqu ote&code="
iLastCompanyRow = oWSCompanyList.Cells.SpecialCells(xlLastCell).Row - 1
iCompanyRow = ASXLIST_OFFSET
Do While iCompanyRow <= iLastCompanyRow
sASXCodes = oWSCompanyList.Cells(iCompanyRow, 2).Value
'sQuoteQuery = sURL & "BHP"
sQuoteQuery = sURL & sASXCodes
Set oHTMLDoc = oMSHTML.createDocumentFromUrl(sQuoteQuery,
vbNullString)
While oHTMLDoc.readyState <> "complete"
DoEvents
Wend
With oHTMLDoc.documentElement
Set oWebTables = .all.tags("table")
Debug.Print sASXCodes
bFoundLast = False
bFoundYield = False
bFoundCap = False
For Each oDataTable In oWebTables
For iTableCell = 0 To oDataTable.Cells.Length - 1
sTableData = Trim(oDataTable.Cells(iTableCell).innerText)
'Debug.Print iTableCell; sTableData
Select Case sTableData
Case "Closing Price"
Debug.Print
oDataTable.Cells(iTableCell).innerText; ":"; oDataTable.Cells(iTableCell +
6).innerText
bFoundLast = True
Exit For
Case "Div Yield"
Debug.Print
oDataTable.Cells(iTableCell).innerText; ":"; oDataTable.Cells(iTableCell +
5).innerText
bFoundYield = True
Exit For
Case "Market Capitalisation"
Debug.Print
oDataTable.Cells(iTableCell).innerText; ":"; oDataTable.Cells(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.createDocumentFromUrl, 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