+ Reply to Thread
Results 1 to 4 of 4

Get part of URL in web query from a specified cell

Hybrid View

doug0147 Get part of URL in web query... 02-17-2011, 10:36 AM
ShredDude Re: Get part of URL in web... 02-17-2011, 09:55 PM
doug0147 Re: Get part of URL in web... 02-18-2011, 10:27 AM
ShredDude Re: Get part of URL in web... 02-18-2011, 06:14 PM
  1. #1
    Registered User
    Join Date
    02-09-2011
    Location
    Florida, USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Get part of URL in web query from a specified cell

    Hi,

    I have this web query.

    Sub engines()
    '
    ' engines Macro
    '
    
    '
        With ActiveSheet.QueryTables.Add(Connection:= _
            "URL;http://www.duskyonline.com/dsc/engine_details.php?EngineName=E40DPL", _
            Destination:=Range("$A$1"))
            .Name = "engine_details.php?EngineName=E40DPL"
            .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 = "9"
            .WebPreFormattedTextToColumns = True
            .WebConsecutiveDelimitersAsOne = True
            .WebSingleBlockTextImport = False
            .WebDisableDateRecognition = False
            .WebDisableRedirections = False
            .Refresh BackgroundQuery:=False
        End With
    End Sub
    Is there a way I can replace the part of the URL that says "E40DPL" to a cell that contains "E40DPL"?

    So the URL would read somthing like this:

    http://www.duskyonline.com/dsc/engin...hp?EngineName=["C1"]

    I know that's not the correct way to write it, but that's what I'm trying to accomplish.

    Thanks for any help.

  2. #2
    Forum Contributor
    Join Date
    07-13-2007
    Posts
    151

    Re: Get part of URL in web query from a specified cell

    You need the concatenate operator "&".

    eg: "blahblahblah=" & range("c1").value

  3. #3
    Registered User
    Join Date
    02-09-2011
    Location
    Florida, USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Get part of URL in web query from a specified cell

    What if I had a URL like this

    http://www.duskyonline.com/dsc/150HP/engine.html

    and I wanted to do this

    http://www.duskyonline.com/dsc/(C1)/engine.html

    how would I write that?

  4. #4
    Forum Contributor
    Join Date
    07-13-2007
    Posts
    151

    Re: Get part of URL in web query from a specified cell

    one way...

    "http://www.duskyonline.com/dsc/" & range("C1").value & "/engine.html"

+ 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