Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
import data from website Maximilian Harmstorf Excel Programming 5 November 8th 16 03:49 PM
Import External data from a Website MichaelRobert Excel Worksheet Functions 6 November 13th 08 02:25 PM
Import data from a website to excel marsocgm Excel Worksheet Functions 1 July 10th 07 03:45 PM
Import And Resize Images 2eXtreme Excel Discussion (Misc queries) 6 February 5th 06 03:47 PM
Import images gav meredith Excel Programming 0 April 8th 04 01:10 AM


All times are GMT +1. The time now is 01:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"