Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting to excel

Status
Not open for further replies.

madrappin

Technical User
Mar 16, 2004
68
US
I use this code to export a query that the user selects into excel.

Code:
Private Sub btnSaveTo_Click()
Dim FilePath1, FileNamePath1, Dataexport

    FilePath1 = LaunchCD(Me)
    
    strName = lstQuery.Column(0)
    
    If FilePath1 = "" Or IsNull(FilePath1) Then
    Else

    FileNamePath1 = FilePath1 & ".xls"
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, strName, FileNamePath1, True

    End If


End Sub

Is it possible to make the listbox a multi-select so the user can select more than one query, and export them into the same excel file as different sheets? Thanks for any help.
 
madrappin,

Unfortunatly the TransferSpreadsheet Method does not have a parameter to specify the destination worksheet.

You will not be able to do this using TransferSpreadsheet method.

Someone may know how to do this using ADO.

Sorry..

Good Luck...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top