Dim html As New mshtml.HTMLDocument
Dim doc As mshtml.IHTMLDocument2 = html
doc.write("<html></html>") 'trick to initialize IPersistStreamInit
doc.close()
doc = html.createDocumentFromUrl("http://www.wired.com/technology.html", vbNullString)
While doc.readyState <> "complete"
Application.DoEvents() 'just waiting for asynchronous load webpage
End While
html = doc
Dim ihec As mshtml.IHTMLElementCollection
ihec = html.getElementsByTagName("a")
Dim sb As New System.Text.StringBuilder
Dim att As Object
For Each ihe As mshtml.IHTMLElement In ihec
att = ihe.getAttribute("className")
If Not att Is Nothing Then
If att.ToString = "hd" Then
sb.AppendLine(ihe.innerText)
End If
End If
Next
MsgBox(sb.ToString)