+ Reply to Thread
Results 1 to 3 of 3

Adding variable to middle of string for querytables.add (to import daily files)

  1. #1
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Adding variable to middle of string for querytables.add (to import daily files)

    Good day all...

    I'm trying to set up a little tool to help verify some data on a website against data in an internal corporate database. The website has a predictable URL we can use to obtain the data, where we have a date value in the middle of the string. I'm able to generate the entire string with no problem, but am not sure how to add that variable to the "querytables.add" command I got when recording the macro.

    Here's what I have at the moment - "url" is the full string with the date variable. Any help is appreciated!

    -- The objective here is simply to import the data from a CSV file saved online... if there's an easier/better way, I'm all ears!

    Please Login or Register  to view this content.
    Thank you for any help!
    Last edited by JP Romano; 06-12-2012 at 01:26 PM. Reason: Solved!

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Adding variable to middle of string for querytables.add (to import daily files)

    Delete the & " in this:

    With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & url & ", Destination:=Range("A2")

    to give:
    Please Login or Register  to view this content.
    Instead of a web query, have you tried File - Open - enter the URL as the file name?
    Post responsibly. Search for excelforum.com

  3. #3
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Re: Adding variable to middle of string for querytables.add (to import daily files)

    Chippy, that did it. Thank you so much!

+ 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