+ Reply to Thread
Results 1 to 14 of 14

Using web query with parameters within a macro

Hybrid View

  1. #1
    Registered User
    Join Date
    05-19-2017
    Location
    Boston, MA
    MS-Off Ver
    2010
    Posts
    9

    Re: Using web query with parameters within a macro

    Yes, I want to put the parameters in place of "ID". Ideally, I'd also like it to update if that number is changed. So if the parameter is located in cell B1, how would I write that?

    Thank you!

  2. #2
    Registered User
    Join Date
    05-19-2017
    Location
    Boston, MA
    MS-Off Ver
    2010
    Posts
    9

    Re: Using web query with parameters within a macro

    Alternatively, I came up with this, which seems to work but doesn't update when O2 is changed. Is there a way to tell it to do that?

    With ActiveSheet.QueryTables.Add(Connection:= _
    "URL;" & Sheets("Worksheet").Range("O2").Value, Destination:=Range("$A$3"))
    .Name = "profile.cfm?authid=[""ID""]_1"
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = True
    .RefreshPeriod = 0
    .WebSelectionType = xlEntirePage
    .WebFormatting = xlWebFormattingNone
    .WebPreFormattedTextToColumns = True
    .WebConsecutiveDelimitersAsOne = True
    .WebSingleBlockTextImport = False
    .WebDisableDateRecognition = False
    .WebDisableRedirections = False
    .Refresh BackgroundQuery:=False
    End With
    End Sub

  3. #3
    Registered User
    Join Date
    05-19-2017
    Location
    Boston, MA
    MS-Off Ver
    2010
    Posts
    9

    Re: Using web query with parameters within a macro

    That did it! Thank you so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. SQL Query and parameters
    By springwood928 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-18-2015, 04:27 PM
  2. automatic Web Query with different parameters
    By mschatz2 in forum Excel General
    Replies: 15
    Last Post: 08-23-2011, 12:20 PM
  3. MS Query - Parameters
    By mattydalton in forum Excel General
    Replies: 4
    Last Post: 11-17-2009, 11:48 AM
  4. Web Query w/parameters
    By sarnone in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-23-2009, 02:01 PM
  5. Query parameters
    By Lac in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2006, 08:10 AM
  6. Query Parameters
    By Texas_Toast in forum Excel General
    Replies: 0
    Last Post: 01-11-2006, 11:20 AM
  7. Parameters for Query
    By Sujith in forum Excel General
    Replies: 1
    Last Post: 04-03-2005, 05:07 AM

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