Okay, I'm needing to do this same thing again, but can't figure out wherethe
item/innertext I need is:
The webpage is:
http://www.gocomics.com/calvinandhobbes/2010/01/16
...and what I need is the image (on this particular page it's):
http://imgsrv.gocomics.com/dim/?fh=83fba46523c3b2f31aeb078a548010a8&w...
thanks, SouthernAtHeart
The following should do want you want. It will paste the image to the
activesheet, but once it is in the clipboard you can do whatever you
want with it...Ron
Sub Comics()
' Open the first webpage
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = True
.navigate "
http://www.gocomics.com/calvinandhobbes/2010/01/16
"
.Top = 50
.Left = 530
.Height = 400
.Width = 400
' Loop until the page is fully loaded
Do Until .ReadyState = 4 And Not .Busy
DoEvents
Loop
' Determine the url for the image
my_var = ie.document.body.innerhtml
loc_1 = InStr(1, my_var, "feature_item>", vbTextCompare)
loc_2 = InStr(loc_1, my_var, "//", vbTextCompare)
loc_3 = InStr(3 + loc_2, my_var, ">", vbTextCompare)
my_url = Trim(Mid(my_var, 2 + loc_2, loc_3 - (2 + loc_2)))
' Go to the image url and copy the image and paste to the activesheet
ie.navigate my_url
Do Until ie.ReadyState = 4 And Not ie.Busy
DoEvents
Loop
ie.ExecWB 17, 2
ie.ExecWB 12, 0
ActiveSheet.PasteSpecial
End With
ie.Quit
End Sub