View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
brad nmore brad nmore is offline
external usenet poster
 
Posts: 1
Default Dear Joel,Great, thank you so much !CheersMax

Joel...
Can you tell me where to place this code... hot to do this....

thank you!

On Friday, October 24, 2008 12:27 AM Maximilian Harmstorf wrote:


Hi all,
I need to get a solution for following problem.

I need to extract a table from a website, like this
http://www.cbot.com/cbot/pub/page/0,3181,1213,00.html and get it into a
useful format
Already tried it with the usual "import website" functions in Excel, but
neither is it working everytime, nor is it possible to add the data instead
of overwriting them all the time.

At the same time I would prefer it to delete unused rows and cells in the
spreadsheet after the import, but this is a minor issue.

It would be nice, if the format could look like this in the end.

17-Sep 16-Sep 15-Sep
24964 25131 25519
27450 27350 27200
27450 27350 27200

Every help is appreciated & thanks in advance

brgds
Max



On Friday, October 24, 2008 6:17 AM Joe wrote:


Sub GetQuotes()

CR = Chr(13)

Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True

URL = "http://www.cbot.com/cbot/pub/page/0,3181,1213,00.html"

'get web page
ie.Navigate2 URL
Do While ie.readyState < 4
DoEvents
Loop

Do While ie.busy = True
DoEvents
Loop
Set cTable = ie.Document.getElementsByTagname("table")
'get all rows excep last row which contains the data
''Table starts at row 0, subtract two to ignore last row
ColCount = 1
For TableRow = 0 To (cTable(0).Rows.Length - 2)
Set TRow = cTable(0).Rows(TableRow)
RowCount = 1
For Each cell In TRow.Cells
Cells(RowCount, ColCount) = _
Trim(Replace(cell.innertext, CR, ""))
RowCount = RowCount + 1
Next cell
ColCount = ColCount + 1
Next TableRow

End Sub


"Maximilian Harmstorf" wrote:



On Saturday, October 25, 2008 11:46 AM max.harmstor wrote:


Dear Joel,

Great, thank you so much !

Cheers
Max



Submitted via EggHeadCafe
LINQ executed in Parallel (PLINQ)
http://www.eggheadcafe.com/tutorials...lel-plinq.aspx