Web Tables

klatlap

Well-known Member
Joined
Sep 1, 2004
Messages
607
Office Version
  1. 2013
Platform
  1. Windows
Hi,

I use a lot of excel web queries, most times when dealing with a new webpage i will run the macro recorder and use the import wizard to gather all the info needed then i will construct my vba code from that.

My question is on some pages they have lots of tables to choose from so i can get just the info i need, but on other pages they will only have 1 and i have to import the whole page, is there a way to look at the html or something so i can get the table i need or do some webpages just have 1 table?
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I can do that only via VBA. I don't think so the Web import wizard has any options for doing that.
If the speed of an operation (query) is not the main issue, I would use the IE object that givs you ability to download the whole page as HTML source and then you can parse the text
if the speed of an operation is main issue, I would use the XML object which means to write much more code but the speed of an operation is way faster
 
Upvote 0
I guess it depends on how fast it would be, right no more than 5 seconds to import the page and is ok for me.

Here is the basic import before i add extra code, it does import SpecidiedTables but i wanted to refine the import to cut down on data import, is it possible or should i just use what i have.


Code:
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://www.betchoice.com/racing/betting.asp?eventid=736196", Destination _
        :=Range("$AD$1"))
        .Name = "betting.asp?eventid=736196_1"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlOverwriteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = """HorseTable"""
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,738
Members
452,940
Latest member
Lawrenceiow

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top