Send data to Excel using "OutputTo"

L

Liz Hansen

Hello,

I'm have several queries that I output to Excel. Then in Excel I move them
all to the same workbook. Is there a way to send more than one query to the
same workbook, just adding a worksheet per query

I'm using the following code at this time:
DoCmd.OutputTo acOutputQuery, "qry1", acFormatXLS, , True
DoCmd.OutputTo acOutputQuery, "qry2", acFormatXLS, , True
and so on

Thanks,

Liz
 
K

Ken Snell [MVP]

Use TransferSpreadsheet for the second, third, etc. queries. It adds a
worksheet to an existing file.
 
L

Liz Hansen

Hi Ken,

I neglected to mention that my queries are CrossTab queries. After reading
up on TransferSpreadsheet it only looks like this will work for Select
Queries only.

Any other way to work around this?

Thanks for your help.

Liz
 
K

Ken Snell [MVP]

I just tested using TransferSpreadsheet to export a crosstab query. Worked
fine.
 
L

Liz Hansen

You are absolutely right. I must have done something wrong when I tried it.

Thanks again for all your help.

Liz
 
Top