Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Harry Hunter   on Jan 31 In MS Office Category.

  
Question Answered By: Birk Fischer   on Jan 31

You can record a web query to download a whole page. Then you need to
find something on the page which IS consistent for each date, such as
the table heading eg. NBA BASKETBALL, then look for one of its
subheadings, which you'll know is going to be somewhere below and to
the right within a limited range, then you'll be able to grab only the
data you want and place it elsewhere.

I tend to steer away from keeping html formatting. I recorded the
following which leaves you with a sheet having something you can work
with:
Sub Macro4()
'
' Macro4 Macro

'

'
With ActiveSheet.QueryTables.Add(Connection:= _

"URL;www.donbest.com/.../all-games.shtml?20070408",
_
Destination:=Range("A1"))
.Name = "all-games.shtml?20070408"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = False
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub

Delete the data  when you've finished farming it and start again with
the next date.

I did this some time ago to get historical results from UK horseracing.

Share: 

 

This Question has 17 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Database Overview Question Or get search suggestion and latest updates.


Tagged: