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
__________________________________________
:
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