+ Reply to Thread
Results 1 to 5 of 5

Multiple web queries

Hybrid View

  1. #1
    Registered User
    Join Date
    04-04-2011
    Location
    Riga
    MS-Off Ver
    Excel 2007
    Posts
    11

    Multiple web queries

    Hello,
    I have a problem changing part of my URL in the web query. It doesn't give me any error back, but it doesn't show my data as well. Something must be wrong with rngURL.Value I guess. In A1 there is "Latvia". Here is my code:

    Sub Macro1()
    
    Dim rngURL As Range
    Dim rngOutput As Range
    
    Set rngOutput = Range("C1")
    
    For Each rngURL In Range("A1:A2").Cells
    With ActiveSheet.QueryTables.Add(Connection:="URL;http://www.erepublik.com/en/country/economy/ & rngURL.Value", Destination:=rngOutput)
            .Name = rngURL.Value
            .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
    
    Set rngOutput = rngOutput.Offset(1, 0)
    Next
    End Sub
    Last edited by skazis; 05-29-2011 at 07:12 AM.

  2. #2
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Multiple web queries

    just remove the quotations:
    .Name = rngURL.Value

  3. #3
    Registered User
    Join Date
    04-04-2011
    Location
    Riga
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Multiple web queries

    It doesn't help.
    As far as I understand, program doesn't understand this

    http://www.erepublik.com/en/country/economy/Latvia

    as

    http://www.erepublik.com/en/country/economy/ & rngURL.Value

    it doesn't even understand this
    "http://www.erepublik.com/en/country/economy/ & Latvia"
    Last edited by skazis; 05-29-2011 at 07:06 AM.

  4. #4
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Multiple web queries

    try this
    "URL;http://www.erepublik.com/en/country/economy/" & rngURL.Value

  5. #5
    Registered User
    Join Date
    04-04-2011
    Location
    Riga
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Multiple web queries

    Thank you very much. Problem solved by your last suggestion.

+ 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