+ Reply to Thread
Results 1 to 2 of 2

Loop thru range params - external web connection

Hybrid View

  1. #1
    Registered User
    Join Date
    11-19-2014
    Location
    Prague
    MS-Off Ver
    2010
    Posts
    2

    Loop thru range params - external web connection

    Hello, please, can anybody help me?
    I made macro for external web connection:

    With ActiveSheet.QueryTables.Add(Connection:= _
    "FINDER;D:\Dokumenty\novinky_web\test.iqy", Destination:=Range("$AN$218"))
    .Name = "test_4"
    .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 = "3"
    .WebPreFormattedTextToColumns = True
    .WebConsecutiveDelimitersAsOne = True
    .WebSingleBlockTextImport = False
    .WebDisableDateRecognition = False
    .WebDisableRedirections = False
    .Refresh BackgroundQuery:=False
    End With
    End Sub

    connection in test.iqy is:

    WEB
    1
    http://dairybulls.com/search/sirepag...p?InterbullID=["Question"]&Bre=HO&genbase=A

    Selection=3
    Formatting=None
    PreFormattedTextToColumns=True
    ConsecutiveDelimitersAsOne=True
    SingleBlockTextImport=False
    DisableDateRecognition=False
    DisableRedirections=False

    ["Question"] is parametr represented by numbers in cells q4:q218 in my excel sheet

    Is any solution how to combine this macro and connection properties in to loop which will run external web connections from down with param from cell q218 to up to q4 and write selection from connection in to cells range from AN218 till AN4
    Thanks a lot for any help

  2. #2
    Registered User
    Join Date
    11-19-2014
    Location
    Prague
    MS-Off Ver
    2010
    Posts
    2

    Re: Loop thru range params - external web connection

    I did it
    If anybody will need such code:
    Dim i As Integer
    For i = 225 To 5 Step -1
       
    
           With ActiveSheet.QueryTables.Add(Connection:= _
            "URL;http://dairybulls.com/search/sirepage/sireUS2.asp?InterbullID=" & Range("AM" & i) & "&Bre=HO&genbase=A" _
            , Destination:=Range("AN" & i - 1))
            .Name = "i"
            .FieldNames = False
            .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 = "3"
            .WebPreFormattedTextToColumns = True
            .WebConsecutiveDelimitersAsOne = True
            .WebSingleBlockTextImport = False
            .WebDisableDateRecognition = False
            .WebDisableRedirections = False
            .Refresh BackgroundQuery:=False
        End With
      Next i
    
    End Sub

+ 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. Excel External Connection Dropping Password from Connection String?
    By mar0isa in forum Access Tables & Databases
    Replies: 1
    Last Post: 03-06-2015, 10:35 AM
  2. [SOLVED] Delete an External Connection
    By Joakim N in forum Excel General
    Replies: 2
    Last Post: 03-03-2014, 06:16 AM
  3. Error on sharing an external data connection
    By efernandes67 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-19-2012, 01:42 PM
  4. Change pivot table external connection
    By efernandes67 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-17-2012, 01:15 PM
  5. External Connection to another Excel Spreadsheet
    By Uziel in forum Excel General
    Replies: 2
    Last Post: 06-24-2010, 03:23 PM

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