Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Import images from a website
Hi
I have a web page with many ( more than 250 ) hyperlinks.When we click on any hyperlink a new web page with some images open. I need to import all the images to excel. Can some body say what is the ideal way of doing this. For any additional details/clarification please post back. Thanks Thyag |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Import images from a website
This code it will give you an idea of what can be done. It wil automaically
create a worksheet Chemicals and then get over 5000 chekicals with the webpages they are located. The hyperlink address on these webpages are not visibble but can be returned as you will see with this code. Sub Getchemicals2() Found = False For Each sht In Sheets If sht.Name = "Chemicals" Then Found = True Exit For End If Next sht If Found = False Then Set ChemicalSht = Sheets.Add(after:=Sheets(Sheets.Count)) ChemicalSht.Name = "Chemicals" Else Sheets("Chemicals").Cells.ClearContents Set ChemicalSht = Sheets("Chemicals") End If Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True URLFolder = _ "http://www.ilo.org/public/english/protection/safework/cis/products/icsc/dtasht/" ChemicalRowCount = 1 For Letters = 0 To 25 AlphaLetter = Chr(Asc("a") + Letters) URL = URLFolder & AlphaLetter & "_index.htm" 'get web page IE.Navigate2 URL Do While IE.readyState < 4 DoEvents Loop Do While IE.busy = True DoEvents Loop H2Found = False For Each itm In IE.document.all If H2Found = False Then If itm.tagname = "H2" Then H2Found = True End If Else If itm.tagname = "A" Then If itm.innertext = "" Then Exit For 'chemical name ChemicalSht.Range("A" & ChemicalRowCount) = itm.innertext 'webpage ChemicalSht.Range("B" & ChemicalRowCount) = itm.href ChemicalRowCount = ChemicalRowCount + 1 End If End If Next itm Next Letters End Sub "Thyag" wrote: Hi I have a web page with many ( more than 250 ) hyperlinks.When we click on any hyperlink a new web page with some images open. I need to import all the images to excel. Can some body say what is the ideal way of doing this. For any additional details/clarification please post back. Thanks Thyag |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
import data from website | Excel Programming | |||
Import External data from a Website | Excel Worksheet Functions | |||
Import data from a website to excel | Excel Worksheet Functions | |||
Import And Resize Images | Excel Discussion (Misc queries) | |||
Import images | Excel Programming |