+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Getting data from web services

Hybrid View

  1. #1
    Registered User
    Join Date
    09-03-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    8

    Getting data from web services

    Hi folks,

    I've got a worksheet that calls a web service to get back some XML. It works great but each week I have to change the query string for the service being called to look at the new weeks data.

    For example:

    I'm currently using: /mydomain.com/mywebservice.asmx/weeklydata?week=1
    next week I'll need data for: /mydomain.com/mywebservice.asmx/weeklydata?week=2

    Ideally, I'd like the week parameter to be added to the query string, based on the value of a cell. e.g. if A1 = 3, it'll pass week 3 to the web service in the query string.

    Anyone know how this can be achieved?

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Getting data from web services

    Hi Skawn
    Try some thing like ....
    ": /mydomain.com/mywebservice.asmx/weeklydata?week=" & Sheets(1).range("A1").value
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    09-03-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Getting data from web services

    Sadly it just tries to call the webservice with " & Sheets(1).range("A1").value as the query string.

    I suspect this isn't possible... the place you enter the URL is a standard windows dialog box so I'm not sure you can get it to look back at the sheet before it pings the service.

    Still, if anyone knows a way...

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Getting data from web services

    shawn
    what the full code???
    maybe...
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
                        Cancel As Boolean)
        Dim strSearch As String
    
        strSearch = Sheets(1).Range("a1").Formula
        If Target = Range("a1") Then
            Cancel = True
            ActiveWorkbook.FollowHyperlink _
            Address:="/mydomain.com/mywebservice.asmx/weeklydata?week=", _
            ExtraInfo:= & strSearch, _
            Method:=msoMethodGet
        End If
    End Sub

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,983

    Re: Getting data from web services

    If you are talking about a web query, then see this article by Jan Karel Pieterse.
    Everyone who confuses correlation and causation ends up dead.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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