+ Reply to Thread
Results 1 to 2 of 2

Static Web Query Syntax

Hybrid View

Pak Bob Static Web Query Syntax 07-26-2008, 08:49 AM
shg Please read the Forum Rules... 07-26-2008, 02:26 PM
  1. #1
    Registered User
    Join Date
    07-26-2008
    Location
    Indonesia
    Posts
    1

    Static Web Query Syntax

    I am having difficulty with the syntax of the ActiveSheet.QueryTables.Add line of following web query:

    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.

    Note that my web query using this .iqy file works fine:

    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
    However, I really need a macro to perform a static query using parameter values found in the spreadsheet.

    Any suggestions for the macro syntax? Much appreciated.
    Last edited by Leith Ross; 07-26-2008 at 12:48 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Please read the Forum Rules and then add a link to your cross-post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1