Consulting

Results 1 to 4 of 4

Thread: write SQL table output to excel using VBA

  1. #1
    VBAX Regular
    Joined
    Jul 2018
    Posts
    12
    Location

    write SQL table output to excel using VBA

    Hi,

    I've created ODBC connection.Now, I need to connect to tables and write data to excel in 3 different sheets (Tab1,Tab2,Tab3).

    I have written code to connect to DSN and a sub procedure which has select statements for 3 tables.(select * from tab1..tab2..tab3)

    Can any one suggest the code on how to get the output of these queries to excel in 3 tabs

    Thanks in advance

  2. #2
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    .copytorecordset

  3. #3
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    Assuming the data is returned as either an ADO or DAO Recordset this should help

    https://msdn.microsoft.com/en-us/vba...t-method-excel

  4. #4
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Or just use a query instead of code.
    Be as you wish to seem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •