Sub GetFXHistory()
With ActiveSheet.QueryTables.Add(Connection:= _"URL;http://www.oanda.com/convert/fxhistory?lang=en&date_fmt=us&exch=USD&expr=EUR&margin_fixed=0&&SUBMIT=Get+Table&format=CSV&redirected=1"&date1=&range.("B1").value &date=&range("B2").value &exch2=&range("B3").value &expr2=&range("B4").value, Destination:=Range(“A1”))
.Name = "fxhistory_1"
.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 = "6"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
It is meant to pass values of 4 parameters (date1, date, exch2, expr2) stored in cells B1 through B4 to the web site which will return a table of numbers base on the parameter values.
WEB
1
http://www.oanda.com/convert/fxhistory?lang=en&date_fmt=us&exch=USD&expr=EUR&margin_fixed=0&&SUBMIT=Get+Table&format=CSV&redirected=1&date1=["Start","Please enter a starting date."]&date=["End","Please enter an ending date."]&exch2=["From","Please enter the original currency."]&expr2=["To","Please enter the currency to convert to."]
Selection=7
Formatting=None
PreFormattedTextToColumns=True
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=False
DisableDateRecognition=False
DisableRedirections=False
Bookmarks