Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822

    I got the Execute method to work to export a named range:
    Code:
    Sub Mytest()
        Dim DBFullName As String
        Dim Cn As ADODB.Connection
        Dim rng As String
        DBFullName = ThisWorkbook.Path & "\" & ThisWorkbook.Name
        Set Cn = New ADODB.Connection
        Cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Owner\June\LL\Umpires.accdb"
        rng = "[Excel 12.0;HDR=Yes;Database=" & DBFullName & "].Test"
        Cn.Execute "INSERT INTO Table1 SELECT * FROM " & rng
        Cn.Close
        Set Cn = Nothing
    End Sub
    Never heard of Excel 'table' before today so no idea if this can be adapted.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  2. #17
    nd0911 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    31
    Perfect !!!!!

    I don't know if after this we will be equal but let me teach you that:


    ThisWorkbook.Path & "" & ThisWorkbook.Name = ThisWorkbook.FullName



    Thank You !

  3. #18
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Thanks for the info. Always learning. I had simply copy/pasted that line from example code and thought I had used something more concise in the past but didn't followup.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 04-07-2016, 04:36 AM
  2. Cant Export data to specific excel sheet by ADODB
    By rangga_osh in forum Import/Export Data
    Replies: 4
    Last Post: 03-14-2013, 04:20 AM
  3. Export columns (table) from access to excel
    By dacodac in forum Programming
    Replies: 4
    Last Post: 01-30-2013, 04:27 AM
  4. Export to Excel from Pivot Table in Access 2010
    By nicon2k in forum Import/Export Data
    Replies: 0
    Last Post: 04-10-2012, 07:02 AM
  5. Export Access Pivot Table to Excel
    By graviz in forum Programming
    Replies: 1
    Last Post: 11-13-2009, 07:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums