+ Reply to Thread
Results 1 to 7 of 7

Export data from closed workbook to active workbook with ADO connection

  1. #1
    Registered User
    Join Date
    12-09-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2003, 2007
    Posts
    16

    Export data from closed workbook to active workbook with ADO connection

    Hi all,

    I just want to export data from closed workbook to active workbook via ADO connection. can anyone help on this?

  2. #2
    Registered User
    Join Date
    09-06-2013
    Location
    Winterville, NC, USA
    MS-Off Ver
    Excel 2013
    Posts
    23

    Re: Export data from closed workbook to active workbook with ADO connection

    It takes VBA coding but here is a good read to assist

    http://support.microsoft.com/default...b;en-us;278973
    hope that helps

  3. #3
    Registered User
    Join Date
    12-09-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2003, 2007
    Posts
    16

    Re: Export data from closed workbook to active workbook with ADO connection

    Given link doesn't works.

  4. #4
    Registered User
    Join Date
    09-06-2013
    Location
    Winterville, NC, USA
    MS-Off Ver
    Excel 2013
    Posts
    23

    Re: Export data from closed workbook to active workbook with ADO connection

    Try this
    Dim strSQL As String, conStr as String
    Dim cnn As New ADODB.Connection
    Dim rs As New ADODB.Recordset


    conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & path & "';" & _
    "Extended Properties=""Excel 12.0;HDR=YES;IMEX=1;"";"

    strSQL = "SELECT [Field1], [Field2] FROM [Worksheet$] WHERE [Thing1] > 1"

    cnn.open conStr
    rs.Open query, cnn, adOpenStatic, adLockOptimistic, adCmdText

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Export data from closed workbook to active workbook with ADO connection

    Hi, Naresh27,

    Copy a range from closed workbooks (ADO) with download of a file.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  6. #6
    Registered User
    Join Date
    12-09-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2003, 2007
    Posts
    16

    Re: Export data from closed workbook to active workbook with ADO connection

    Yeah that's working.

    Also, how to Paste some range of cells to Closed workbook. can anyone?

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Export data from closed workbook to active workbook with ADO connection

    Hi, Naresh27,

    you may use ADO (but that will create a new workbook as far as I know). The only way I know of is to open the workbook, paste, close with changes.

    Ciao,
    Holger

+ 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. Run Macro in closed workbook and copy specific coloumn in active workbook
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-07-2013, 03:43 AM
  2. Get data from closed workbook - ADO connection
    By marzook in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-11-2013, 01:43 AM
  3. Export from active worksheet to closed workbook
    By mbcluck in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2009, 10:54 AM
  4. How to export data to a closed Workbook
    By newbie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2005, 05:05 AM
  5. Export data to a closed workbook
    By Luis in forum Excel General
    Replies: 0
    Last Post: 05-21-2005, 09:06 AM

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