Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Okay, I'm needing to do this same thing again, but can't figure out where the
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=8...8010a8&w=900.0 thanks, SouthernAtHeart "Joel" wrote: You don't need to get the source. You can use the IE explorer like below to help you filter the data. The source is under the IE.Document.all property. You can get these lines by doing a loop like this for each itm in IE.Document 'your code here next itm You can use the methods getElementsByTagname(), and getElementById() to help you filter the data. I often for debuggin use something like this RowCount = 1 for each itm in IE.Document Range("A" & RowCount) = itm.tagname Range("B" & RowCount) = itm.Classname Range("C" & RowCount) = itm.id Range("D" & RowCount) = left(itm.innertext,1024) RowCount = rowcount + 1 next itm The source is partioned into items. Has you go down the ALL property the innertext is partioned into small pices. When you do the dump above you will see the same innertext repeated over and over again but broken into samller pieces each time it is repeated. If you need more help give me the URL and I will get what you need. I help lots of people who have had problems. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jan 18, 12:14*pm, Southern at Heart
wrote: Okay, I'm needing to do this same thing again, but can't figure out where the 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=8...078a548010a8&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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks.
Works great! What would I need to change to make this work in Word 2003? Seems like it all works accept the activesheet.pastespecial. I thought it might be activedocument.pastespecial, but it must not be... thanks again. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How can I end this code so that it will save the image in 'My Documents'
instead of pasting it into the word document? It is a .gif format on the web, but it can be something else if it's easier. Thanks. "ron" wrote: On Jan 18, 12:14 pm, Southern at Heart wrote: Okay, I'm needing to do this same thing again, but can't figure out where the 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=8...078a548010a8&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 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Saving data to a webpage | New Users to Excel | |||
getting data from website's url and webpage | Excel Programming | |||
Importing webpage data into Excel | Excel Discussion (Misc queries) | |||
Get Webpage data as text using VBA w/o Webquery | Excel Programming | |||
data from external webpage | Excel Programming |