VBA to export query or table Excel

Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: VBA to export query or table Excel

  1. #1
    Board Regular
    Join Date
    Aug 2009
    Posts
    110
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA to export query or table Excel

     
    Good morning. I am currently exporting queries into an excel file using TransferSpreadsheet command.
    An example of the line I use for a query is:

    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "qry_Metrics_Top_Ten_All_Corp1", "C:\SAP_Exports\Metrics_Data_PP.xlsx", True

    Is there a way to export the query data to a specific tab and a specified location? Like: "C:\SAP_Exports\Metrics_Data_PP.xlsx", tab 1, A2,

    Last edited by Tcurtis; Dec 1st, 2017 at 10:23 AM.

  2. #2
    MrExcel MVP
    Moderator
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    42,630
    Post Thanks / Like
    Mentioned
    15 Post(s)
    Tagged
    1 Thread(s)

    Default Re: VBA to export query or table Excel

    Take a look at the different options presented here: https://bytes.com/topic/access/answe...specific-range
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

  3. #3
    Board Regular
    Join Date
    Aug 2009
    Posts
    110
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA to export query or table Excel

      
    This works great! Took me just a few minutes and I got my first results back. Thank you!!

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com