Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Web Query, not capturing data

Ok, here's my issue I need to download data from a website
(http://nymex.greenfutures.com/markets/rj-csf.html), in the past i would
download/link the file to a csv file or an MS Excel workbook then export the
needed data. I believe that it is the fact that this page utilizes XHTML.

How can I collect the data off the page so I can put it into Excel

Any help would be welcomed.

If i have posted this in the wrong forum please let me know.

Terry
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Web Query, not capturing data


The data on the page is in a frame which the webpage gets from a second
URL. the code below goes to the 2nd URL and puts the data on Sheet1.


Sub greenfutures()

URL = "http://nymex.greenfutures.com/markets/rj-csf.html"

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


'get web page
IE.Navigate2 URL
Do While IE.readystate < 4 Or _
IE.busy = True
DoEvents
Loop

Set IFrame = IE.document.getelementsbytagname("IFRAME")

src = IFrame.Item(0).src


'get web page
IE.Navigate2 src
Do While IE.readystate < 4 Or _
IE.busy = True
DoEvents
Loop

'wait until all the data is returned.
Do
Set Table = IE.document.getelementsbytagname("Table")
Set Data = Table(1)
Loop While Data Is Nothing

With Sheets("sheet1")
RowCount = 1
For Each IRow In Data.Rows
ColCount = 1
For Each cell In IRow.Cells
.Cells(RowCount, ColCount) = cell.innertext
ColCount = ColCount + 1
Next cell
RowCount = RowCount + 1
Next IRow
End With

IE.Quit
End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=151687

Microsoft Office Help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Web Query, not capturing data

I f you get this message respond back at the following webpage

http://www.thecodecage.com/forumz/ex...ring-data.html

The microsoft help is also posted at WWW.THECODECAGE.com

The microsoft webpage often stops sending e-mail message out. I responded
to your request on friday but apparently you didn't get notified. The
webpage data is inside a frame that gets loaded from a 2nd URL. You can't
get download the data from the 1st URL you have to go to the 2nd URL to
actual extract data. the code below will automatically get the data.


Sub greenfutures()

URL = "http://nymex.greenfutures.com/markets/rj-csf.html"

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


'get web page
IE.Navigate2 URL
Do While IE.readystate < 4 Or _
IE.busy = True
DoEvents
Loop

Set IFrame = IE.document.getelementsbytagname("IFRAME")

src = IFrame.Item(0).src


'get web page
IE.Navigate2 src
Do While IE.readystate < 4 Or _
IE.busy = True
DoEvents
Loop

'wait until all the data is returned.
Do
Set Table = IE.document.getelementsbytagname("Table")
Set Data = Table(1)
Loop While Data Is Nothing

With Sheets("sheet1")
RowCount = 1
For Each IRow In Data.Rows
ColCount = 1
For Each cell In IRow.Cells
..Cells(RowCount, ColCount) = cell.innertext
ColCount = ColCount + 1
Next cell
RowCount = RowCount + 1
Next IRow
End With

IE.Quit
End Sub


"tmacdonald" wrote:

Ok, here's my issue I need to download data from a website
(http://nymex.greenfutures.com/markets/rj-csf.html), in the past i would
download/link the file to a csv file or an MS Excel workbook then export the
needed data. I believe that it is the fact that this page utilizes XHTML.

How can I collect the data off the page so I can put it into Excel

Any help would be welcomed.

If i have posted this in the wrong forum please let me know.

Terry

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Web Query, not capturing data

Thank you Joel, That definately did the trick.

Terry

"Joel" wrote:

I f you get this message respond back at the following webpage

http://www.thecodecage.com/forumz/ex...ring-data.html

The microsoft help is also posted at WWW.THECODECAGE.com

The microsoft webpage often stops sending e-mail message out. I responded
to your request on friday but apparently you didn't get notified. The
webpage data is inside a frame that gets loaded from a 2nd URL. You can't
get download the data from the 1st URL you have to go to the 2nd URL to
actual extract data. the code below will automatically get the data.


Sub greenfutures()

URL = "http://nymex.greenfutures.com/markets/rj-csf.html"

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


'get web page
IE.Navigate2 URL
Do While IE.readystate < 4 Or _
IE.busy = True
DoEvents
Loop

Set IFrame = IE.document.getelementsbytagname("IFRAME")

src = IFrame.Item(0).src


'get web page
IE.Navigate2 src
Do While IE.readystate < 4 Or _
IE.busy = True
DoEvents
Loop

'wait until all the data is returned.
Do
Set Table = IE.document.getelementsbytagname("Table")
Set Data = Table(1)
Loop While Data Is Nothing

With Sheets("sheet1")
RowCount = 1
For Each IRow In Data.Rows
ColCount = 1
For Each cell In IRow.Cells
.Cells(RowCount, ColCount) = cell.innertext
ColCount = ColCount + 1
Next cell
RowCount = RowCount + 1
Next IRow
End With

IE.Quit
End Sub


"tmacdonald" wrote:

Ok, here's my issue I need to download data from a website
(http://nymex.greenfutures.com/markets/rj-csf.html), in the past i would
download/link the file to a csv file or an MS Excel workbook then export the
needed data. I believe that it is the fact that this page utilizes XHTML.

How can I collect the data off the page so I can put it into Excel

Any help would be welcomed.

If i have posted this in the wrong forum please let me know.

Terry

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
capturing all of the data jimbo Excel Worksheet Functions 7 July 27th 08 06:10 PM
Web Query - Submitting Data and Capturing Result Ben Excel Discussion (Misc queries) 0 October 6th 05 02:29 PM
Query Refresh capturing rows returned to display progress Stewart Excel Programming 0 September 2nd 05 04:05 PM
Capturing query table errors T. Erkson Excel Programming 3 February 28th 05 05:26 PM
Capturing query table errors T. Erkson Excel Worksheet Functions 1 February 24th 05 09:26 PM


All times are GMT +1. The time now is 01:24 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"