Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Tables from web to excel

I am able to navigate to a webpage, but wish to copy only one table from the
page - table(2).

How do i get it from the webpage to excel? I know that the code below will
make xTable the 2nd table, but how do i get the table to appear in excel
instead of [object]

Dim oResultPage As HTMLDocument
Dim AllTables As IHTMLElementCollection
Dim xTable As IHTMLTable

Set oResultPage = ie.Document
Set AllTables = oResultPage.getElementsByTagName("table")
Set xTable = AllTables.Item(2)


thanks
George
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Tables from web to excel

I always use Data - Import External Data - New WebQuery (hope this is the
correct translation)
Record a macro and study the code, you may get sth like this:

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.nordpool.com/marketinfo/elspot/stockholm/elspot.cgi?interval=last8&ccurrency=nok&type=html"
_
, Destination:=Range("W15"))
.Name = "elspot.cgi?interval=last8&ccurrency=nok&type=html "
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "4" '*********HERE IS THE TABLE CHANGE IF
NECESSARY!!!!!
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With


HTH
knut


"georgesmailuk" skrev i melding
...
I am able to navigate to a webpage, but wish to copy only one table from
the
page - table(2).

How do i get it from the webpage to excel? I know that the code below
will
make xTable the 2nd table, but how do i get the table to appear in excel
instead of [object]

Dim oResultPage As HTMLDocument
Dim AllTables As IHTMLElementCollection
Dim xTable As IHTMLTable

Set oResultPage = ie.Document
Set AllTables = oResultPage.getElementsByTagName("table")
Set xTable = AllTables.Item(2)


thanks
George



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
concatenate tables into html tables urlocaljeweler Excel Discussion (Misc queries) 1 December 11th 09 08:15 PM
concatenate tables into html tables urlocaljeweler New Users to Excel 1 December 11th 09 06:30 AM
Opening Excel 03 files in Excel 07 Pivot tables & graph not workin Dan McKinney Excel Discussion (Misc queries) 1 July 1st 08 05:46 PM
Pivot4U Excel Add-in - Edit Pivot Tables in Excel Directly [email protected] Excel Discussion (Misc queries) 0 May 30th 08 11:09 PM
Building pivot tables in Excel 2007 based on existing pivot tables? [email protected] Excel Discussion (Misc queries) 4 December 26th 07 08:05 PM


All times are GMT +1. The time now is 12:16 PM.

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"