Export query to Excel using VBA

J

Jordan

Currently I am using:

=====================
Set MyFileName = "P:\Userdata\Jon Doe\Excel Docs\MyExcel.xls"
DoCmd.OutputTo acOutputQuery, "MyQuery", _
acSpreadsheetTypeExcel9, MyFileName, True

=====================
But for some reason Windows 2000 PCs running Access 2000 get

"Error 2282: The formats that enable you to output data as a Microsoft
Excel, rich-text format, MS-DOS text, or HTML file are missing from the
Windows Registry"

When I run the DoCmd.OutputTo command. Is there another way to have a Query
fire up and export to excel?
 
J

Jamie Collins

Jordan said:
Currently I am using:

=====================
Set MyFileName = "P:\Userdata\Jon Doe\Excel Docs\MyExcel.xls"
DoCmd.OutputTo acOutputQuery, "MyQuery", _
acSpreadsheetTypeExcel9, MyFileName, True

Is there another way to have a Query
fire up and export to excel?

Sure is:

SELECT *
INTO
[Excel 8.0;Database=P:\Userdata\Jon Doe\Excel Docs\MyExcel.xls;].ExcelTableName
FROM MyQuery
;

Jamie.

--
 

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