export two sheets in same excel file

J

James

I have this code which exports a data table to excel:

st = Me!List0.Column(0)
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, st, strPath &
"/" & st & ".xls"
Application.FollowHyperlink strPath & "/" & st & ".xls"

(line two and three are one line in VB)

Problem is, I would also like to export at the same time another table
explaining the field names of the first table (FIELD_KEY, FIELD_DESCRIP). I
would like to export this second table to another worksheet in the same excel
file. Is this possible???

Thanks,
 
K

Ken Snell \(MVP\)

Yes. Do a second TransferSpreadsheet to the same EXCEL file; just be sure
that the "st" variable is a different value (query/table name) in the second
TransferSpreadsheet action. So long as you specify different names for the
table/query being exported, ACCESS will put each table/query data on
separate worksheets.
 

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