I'm attempting to use VBA to scrape the link to a .gif file from this HTML fragment:
<div class="row">
<div class="col-md-12">
<div id='imageDiv' style='width:99%'>
<img style='width:99% !important; border:5px solid silver;' src="http://www.[rest of link].gif" alt="" />
</div>
My code below :
parent_url = "http://www.[webpage url]"
objIE.navigate parent_url
While objIE.Busy Or objIE.readyState <> 4
DoEvents
Wend
For Each ele In objIE.document.getElementsByTagName("imageDiv")
If InStr(ele.Style, "width") > 0 Then
ws1.Cells(2, 2) = ele.innerText: Exit For
End If
Next
objIE.Quit
This doesn't write anything to the spreadsheet even when I try a number of different element types. Any pointers about what I'm doing wrong here? TIA