export to excel

P

Pam Coleman

If I have a make table query and have created a macro to:
Open the query and then transfer the spreadsheet, is there a way to have the
macro to also open the excel file and then close access?
 
F

fredg

If I have a make table query and have created a macro to:
Open the query and then transfer the spreadsheet, is there a way to have the
macro to also open the excel file and then close access?

Using code you can do it like this:
(Watch for line wrap on the longer lines.

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97,
"YourQueryName", "C:\PathToSpreadsheet\SpreadsheetName.xls", True

Application.FollowHyperlink "C:\PathToSpreadsheet\SpreadsheetName.xls"

DoCmd.Quit
 
Top