+ Reply to Thread
Results 1 to 3 of 3

manipulating address in web query

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-01-2007
    Posts
    101

    manipulating address in web query

    i am trying to get the web address to allow for an updated date in the "15-AUG-2008" section towards the end, so when tomorrow comes i dont have to change it manually. im sure there will have to be some kind of concatenation, however i cant figure what to put in the middle. thanks.

    Sub URL_Get_Query()
       With ActiveSheet.QueryTables.Add(Connection:= _
          "URL;http://www2.standardandpoors.com/servlet/Satellite?pagename=spcom/page/download&sectorid=%20%3E%20'00'&itemname=%3E=%20'1'&dt=15-AUG-2008&indexcode=500", _
             Destination:=Range("a1"))
    
          .BackgroundQuery = True
          .TablesOnlyFromHTML = True
          .Refresh BackgroundQuery:=False
          .SaveData = True
       End With
    End Sub

  2. #2
    Forum Contributor
    Join Date
    07-01-2008
    Location
    Cincinnati, OH
    Posts
    150
    Try this...

    Sub URL_Get_Query()
        Dim URLDatePart As String
            
        'if single digit dates contain a leading zero such as 01-AUG-2008
        'then use "DD-MMM-YYYY" as your format string
        URLDatePart = UCase(Format(Date, "D-MMM-YYYY"))
        
        With ActiveSheet.QueryTables.Add(Connection:= _
           "URL;http://www2.standardandpoors.com/servlet/Satellite?pagename=spcom/page/download&sectorid=%20%3E%20'00'&itemname=%3E=%20'1'&dt=" & URLDatePart & "&indexcode=500", _
              Destination:=Range("a1"))
        
           .BackgroundQuery = True
           .TablesOnlyFromHTML = True
           .Refresh BackgroundQuery:=False
           .SaveData = True
        End With
    End Sub

  3. #3
    Forum Contributor
    Join Date
    10-01-2007
    Posts
    101
    thanks tom.

+ 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