+ Reply to Thread
Results 1 to 8 of 8

Read from other workbook adodb

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Read from other workbook adodb

    Hi,

    to read SQL statement from other workbook i am using:

    Please Login or Register  to view this content.
    and this is not working.

    And i found in internet that in the end of it should be :
    Please Login or Register  to view this content.
    Still this is not working.

    What is correct sytax for it?

    Best,
    Jacek

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Read from other workbook adodb

    The correct type is 'Excel 12.0 Macro' for an xlsm file, but for a simple SELECT statement, why not just open a connection to that workbook?
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Read from other workbook adodb

    hi xlnitwit.

    thank you.
    You are fast

    MY whole code is :

    Please Login or Register  to view this content.
    IT is left join.
    Hmm why to open connection if i can add [Macro 12.0] in the end of statement? (and where i should add this? This is not working).

    Best,
    Jacek

  4. #4
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Read from other workbook adodb

    And other question is:

    How to open different connection for previous workbook and combine it with connection to current workbook?

    Open 2 connections and how to create SQL for these?

    Best,
    Jacek

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Read from other workbook adodb

    I suggested opening a connection because there was no mention of any other tables in your original post.

    The syntax would be something like this
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Read from other workbook adodb

    ok thank you xlnitwit!

    I am checking this !

    Best,
    Jacek

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,569

    Re: Read from other workbook adodb

    Try change to
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Read from other workbook adodb

    Amazing working like a charm!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Expected table is not in the expected format - ADODB Connection to Read Only Excel file
    By Roshan10043 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2018, 10:54 AM
  2. [SOLVED] use field names in ADODB query to an Excel workbook
    By bagullo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-25-2016, 05:28 AM
  3. Open workbook in read only or read write for excel 2010 version
    By Agent1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-20-2014, 07:19 PM
  4. Use Excel as Database by opening excel workbook as ADODB object
    By dragonvoice in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-21-2013, 04:13 AM
  5. ADODB Connection from different workbook
    By Roshan10043 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-02-2013, 11:24 PM
  6. How do I copy data from one workbook to create drop down lists in another workbook
    By mikeuk24 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2013, 05:08 PM
  7. Replies: 3
    Last Post: 04-11-2012, 09:07 PM

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