Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Exporting to excel

Discussion in 'Information Technology' started by danijela.simunovic@gmail.com, Oct 31, 2005.

  1. danijela.simunovic@gmail.com

    Guest

    Hi! I know how to export one query or table to excel. But is there a
    way to export few tables or querys to one excel file but to different
    sheets? So if i want to export 5 tables it would make 5 sheets in
    excel. Any help would be great!

    Danijela
     
  2. Loading...

    Similar Threads Forum Date
    Canada Sukhdeep Kaur Chohan of Brampton Wins PM Award for Teaching Excellence Breaking News Mar 5, 2014
    India Sikh Regiment's Passion for Excellence Breaking News May 19, 2013
    Leisure Excellence -skills-Attitude Business, Lifestyle & Leisure Feb 14, 2010
    Katha Excellent Katha by Bhai Ram Singh Kathavachak Videos Aug 8, 2009
    [SPN] Celebrating Five Years of Excellence & Learning Announcements Jun 3, 2009

  3. Tom Wickerath

    Tom Wickerath
    Expand Collapse
    Guest

    Hi Danijela,

    Try using DoCmd.TransferSpreadsheet instead of DoCmd.OutputTo, as in the
    following example:

    DoCmd.TransferSpreadsheet TransferType:=acExport, _
    TableName:=strSourceName, Filename:=strFileName, _
    HasFieldNames:=True

    where strSourceName is a string variable that contains the name of the table
    or query that you want to export, and strFileName is the complete path and
    filename for the Excel file. You can do something like this:

    Dim strFileName as String
    strFileName = CurrentProject.Path & "\ExportedData.xls"

    for a hardcoded Excel filename, or you can pass strFileName in as a
    parameter to the subroutine or function:

    strFileName = CurrentProject.Path & "\" & strFileName


    Tom

    http://www.access.qbuilt.com/html/expert_contributors.html
    __________________________________________

    "danijela.simunovic@gmail.com" wrote:

    Hi! I know how to export one query or table to excel. But is there a
    way to export few tables or querys to one excel file but to different
    sheets? So if i want to export 5 tables it would make 5 sheets in
    excel. Any help would be great!

    Danijela
     
  4. Bruno Campanini

    Bruno Campanini
    Expand Collapse
    Guest

    <danijela.simunovic@gmail.com> wrote in message
    news:1130688973.523316.89300@g49g2000cwa.googlegroups.com...
    > Hi! I know how to export one query or table to excel. But is there a
    > way to export few tables or querys to one excel file but to different
    > sheets? So if i want to export 5 tables it would make 5 sheets in
    > excel. Any help would be great!
    >
    > Danijela


    From Access to Excel?
    If so:

    DoCmd.TransferSpreadsheet _
    TransferType:=acExport, _
    SpreadsheetType:=acSpreadsheetTypeExcel9, _
    TableName:="Table1", _
    FileName:="C:\Document\Excel\XLS\Book1.xls", _
    HasFieldNames:=True, _
    Range:="Sheet3!B10:F40"

    Should you need further help, please be more precise .

    Ciao
    Bruno
     
  5. danijela.simunovic@gmail.com

    Guest

    Thanks! I like this part "CurrentProject.Path" so that the xls file
    is going to be in the access folder! Great thing! Thanks!
     
  6. danijela.simunovic@gmail.com

    Guest

    I removed Range:="Sheet3!B10:F40" and put this
    Range:="Sheet3" and the code works great! And I also put some more
    tables and it works great!
    Thanks!
     

Share This Page