Hi KJ, and welcome to the forum.
You can try this script to get you going, the output is almost what you wanted.
Please keep in mind the macro will be based on a 3rd parties website, so you'll be dependant on their layout...
See also the URL in the comments, it would help you explain the subject even more.
Sub test()
URL = "http://www.investing.com/etfs/horizons-betapro-tsx-60-bull-plus-technical?period=86400"
' Create and Send HTTP req
Set objHttp = CreateObject("Microsoft.XMLHTTP")
objHttp.Open "GET", URL, False
objHttp.setRequestHeader "Content-Type", "text/xml"
objHttp.send
' Handle Response
sHTML = objHttp.ResponseText
'see http://scriptorium.serve-it.nl/view.php?sid=40 for more info about extracting the info
'Extract the desired information from the returned HTML code (text)
'To make things a little easier I usually cut of most of the unwanted code first
'so sHTML is smaller to work with.
lTopicstart = InStr(1, sHTML, "<!-- ---------Summary Box----------------- -->", vbTextCompare)
lTopicend = InStr(1, sHTML, "<!-- Tables -->", vbTextCompare)
sHTML = Mid(sHTML, lTopicstart, lTopicend - lTopicstart)
'Now extract all text within the hyperlinks <a href..>..</a>
'because they represent the topics
i = 1
lTopicstart = 1
lTopicend = 1
Do While lTopicstart <> 0
i = i + 1
lTopicstart = InStr(lTopicend, sHTML, "<span class", vbTextCompare)
If lTopicstart <> 0 Then
lTopicstart = InStr(lTopicstart, sHTML, ">", vbTextCompare) + 1
lTopicend = InStr(lTopicstart, sHTML, "</span>", vbTextCompare)
sAllPosts = sAllPosts & Chr(13) & Mid(sHTML, lTopicstart, lTopicend - lTopicstart)
End If
Loop
'Clean up
Set oHttp = Nothing
Debug.Print sAllPosts
End Sub
Cheers,
Rick
Bookmarks