how to get image from html
trying to find a way to loop on a web page and grab an image.
<a href="http://www.taco.com/url/http://sharepointed.com/folder/src/blah.png" target="_blank">
gets a little more tricky, because i need to grab a url from the href.
Code:
Dim objIE As Object
Dim iDoc As HTMLDocument
Dim iElmnt As IHTMLElement
Dim strURL As String
Dim strHTML As String
strURL = "http://sharepointed.com"
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.navigate strURL
.Visible = True
End With
Do: Loop Until objIE.ReadyState = READYSTATE_COMPLETE
Set iDoc = objIE.Document
For Each iElmnt In iDoc.getElementsByTagName("a href")
strHTML = iElmnt.outerHTML
If InStr(1, strHTML, "http://sharepointed.com/folder/src/") > 0 Then
x = 1
End If
Next
Re: how to get image from html
Quote:
For Each iElmnt In iDoc.getElementsByTagName("a href")
i do not believe this is correct, try
vb Code:
For Each iElmnt In iDoc.getElementsByTagName("a")
if instr(iElmnt.href.value, "http://sharepointed.com/folder/src/") > 0 then ' download
try using urldownloadtofile APIn search here and vb6 forum
use ielmnt.href.value as the url to download, and a valid path\filename to save to