Dynamic Web Data Extraction

AlInVegas

New Member
Joined
Dec 31, 2007
Messages
19
I am trying to write a script that will use Stock Symbol, Period Start and Period End dates entries to dynamically pull the info from the web. I recorded the setup of an External Data extract to kludge together a data string that adds the range of data I'm looking for (1 year previous to the start date to the end date) based on the users input. The problem is that it only captures the first page of the selected data. Anybody know what data property or variable I can add to the string to have it pull all the data? Better still, can anyone recommend a training guide to dynamic web extraction for Excel. Thanks

Range("ClearData").Select
StartDate = Range("StartDate").Value - 365
EndDate = Range("EndDate").Value
Stock = Range("Stock").Value
Incoming = "URL;http://finance.yahoo.com/q/hp?a=" _
& Format(Format(StartDate, "MM") - 1, "00") & "&b=" _
& Format(StartDate, "DD") & "&c=" _
& Format(StartDate, "YYYY") _
& "&d=" _
& Format(Format(EndDate, "MM") - 1, "00") & "&e=" _
& Format(EndDate, "DD") & "&f=" _
& Format(EndDate, "YYYY") & "&g=d&s=" _
& Stock

StockData = Range("StockData").Address
With ActiveSheet.QueryTables.Add(Connection:=Incoming _
, Destination:=Range(StockData))
.Name = "Stock Search"
.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 = "15"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,216,562
Messages
6,131,422
Members
449,651
Latest member
Jacobs22

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