Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
concatenate tables into html tables | Excel Discussion (Misc queries) | |||
concatenate tables into html tables | New Users to Excel | |||
Opening Excel 03 files in Excel 07 Pivot tables & graph not workin | Excel Discussion (Misc queries) | |||
Pivot4U Excel Add-in - Edit Pivot Tables in Excel Directly | Excel Discussion (Misc queries) | |||
Building pivot tables in Excel 2007 based on existing pivot tables? | Excel Discussion (Misc queries) |