Results 1 to 3 of 3
  1. #1
    mathhero is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    6

    Code for export Qeury ,Report or Table In Access Database to Excel File

    Hi
    Code for export Qeury ,Report or Table In Access Database to Excel File

    I need this code

    I have this


    Code:
    On Error GoTo Err_ToExcel_Click
    Dim stDocName As String
    Dim theFilePath As String
    stDocName = "AliElbasry"
    'DoCmd.OpenQuery stDocName
    theFilePath = Application.CurrentProject.Path
    theFilePath = theFilePath & stDocName & ""
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, stDocName, theFilePath, True
    Exit_ToExcel_Click:
        Exit Sub
    Err_ToExcel_Click:
        MsgBox "Error"
        Resume Exit_ToExcel_Click
    End Sub

    I need the code when I click appear some Dialog box to chosse the Path to save the file

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Google: Access VBA browse folder

    Review:
    http://access.mvps.org/access/api/api0002.htm
    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.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Also look here:
    Ken's ACCESS Examples and Information for Working With EXCEL Workbook Files
    http://www.accessmvp.com/KDSnell/EXCEL_MainPage.htm

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Excel file that I export from Access is extremely large
    By Ronald Mcdonald in forum Access
    Replies: 1
    Last Post: 05-25-2012, 03:32 PM
  2. Replies: 3
    Last Post: 08-18-2011, 05:04 PM
  3. Replies: 3
    Last Post: 02-01-2011, 10:18 AM
  4. Replies: 1
    Last Post: 08-12-2010, 10:04 PM
  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