Export a table to Excel (VBA)

Posted on 2010-01-05
Last Modified: 2013-11-27
I want to do one simple thing.

Push a button and export "MyTable" to Excel.

To make things easy, save in my documents folder.
File name will be provided on form text box.
Question by:phileoca
    LVL 119

    Accepted Solution

    Dim strDir
    strDir = Environ("userprofile") & "\My Documents\"

    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Mytable", strDir & Me.textboxName, True
    LVL 14

    Author Closing Comment

    I knew there was a quick and easy solution to this.

    Always a pleasure!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
    Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now