export to excel

C

Chris

I want to export a query to excel through a macro. I am
having trouble with docmd.transferspreadsheet. Any help?

The query and the speadsheet should have the same name.
 
R

Ron Weiner

Don't know about macros, but using VBA:

docmd.TransferSpreadsheet
acExport,acSpreadsheetTypeExcel9,"NameofyourQuery","c:\NameofyourQuery"

Substuite "NameofyourQuery" with the actual name your your saved query. The
results from "NameofyourQuery" will be in an Excel spreadsheet with the name
"NameofyourQuery" in the root of your C: drive.

Ron W
 
C

ColetteD

Hi Chris

I'm not sure about the docmd option but I generally use the "output to"
option and then just populate it with the selected table or query and the
location of the output.

Easier for me as I'm no good with VBA.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top