+ Reply to Thread
Results 1 to 2 of 2

SQL Query to Another Excel File

  1. #1
    Registered User
    Join Date
    07-02-2008
    Location
    Prague, Czech Republic
    Posts
    22

    SQL Query to Another Excel File

    hello!
    First post, so please don't bite!
    I'm needing to write some code which sits in an excel file, which pulls data from another excel file using SQL on an ADO connection. (this excel file stays closed)
    That, is all ok, and have it working.
    The bit that I can't seem to get to work, is that I want the results of the query to be downloaded to a '3rd' excel file (which is open).

    When I do put this third sheet as the target address, I get an error saying
    Run-time error '-2147217904 (80040e10)':

    No value given for one or more required parameters.
    The Code I'm using is this...

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    So the error certainly seems to relate to the target address. But the odd bit is that at the point I get the error, it's not even looked at the target address.
    It's also (probably) worth me noting that if I set the target address as
    Please Login or Register  to view this content.
    ie, reference the workbook, but still use the same workbook / destination as the target that works ok, I also get the error.

    Can any shed any light on what I'm doing wrong here?

    Oh, one other question;

    does anyone know how I can get the query to download the column names at the time of running the query? I read that it can't be done with ADO, but does anyone here know otherwise?

    Thanks for your help - really appreciate it!

    Edit:

    Just to add, the value of sTarget2 is "TRADING_CC_CUSTOM.XLS", and this is definitely correct, as it uses this variable to create & name the file I'm trying to download the data to!
    Last edited by aldredd; 07-02-2008 at 04:51 AM.

  2. #2
    Registered User
    Join Date
    07-02-2008
    Location
    Prague, Czech Republic
    Posts
    22
    Well, I've figured out the column headers bit, but just can't get it to send the data to the other workbook, only the workbook which the code is being ran from.
    Last edited by aldredd; 07-02-2008 at 09:11 AM.

+ 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