Hello all. The following code performs the desired task though not until completion. There are roughly 200 hyperlinks with 6 elements taken from each link. Is there any way that I can speed this up/free up memory? It is incredibly slow and then blocks at 200 odd elements. Any help greatly appreciated.
Cheers
Dan
Option Explicit
Sub getdog()
Dim ie As Object ' InternetExplorerMedium
Dim images As Object ' MSHTML.IHTMLElementCollection
Dim image As Object ' MSHTML.IHTMLElement
Dim y As Long
Dim cel As Range
Set ie = CreateObject("InternetExplorer.Application")
y = 1
With Sheets("sheet1")
For Each cel In .Range("A2:A" & .Cells(Rows.Count, "A").End(xlUp).Row)
ie.navigate cel
Do While ie.Busy Or ie.readyState <> 4
DoEvents
Loop
Set images = GetAllImages(ie)
For Each image In images
Sheets("sheet2").Range("A" & y).Value = image.outerText
y = y + 1
Next image
Next
End With
End Sub
Function GetAllImages(ie As Object) As Object
Set GetAllImages = ie.document.getElementsByClassName("gh-racing-runner-greyhound-name")
End Function
Bookmarks