Can I Use TransferSpreadsheet to export ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've set up this VB command,

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"tbl.MasterTestResults", "C:\Data\MasterTestResults.xls", ,
"tblMasterTestResults"

but the compiler is highlighting acExport and saying its an "invalid outside
procedure"

How do I set up to export ?
 
Yes, but I saw two problems:
1. The last argument in your action is not allowed for exports. It is only
for imports so you can identify exactly what data from a workbook you want.
I read somewhere there is a way to trick it, but I don't know what it is.

2. I took the "." out of tblMasterTestResults. I doubt that is your table
name

Try this:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"tblMasterTestResults", "C:\Data\MasterTestResults.xls"
 
Thanks. I tried

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"tblMasterTestResults", "C:\Data\MasterTestResults.xls"

The names and locations of the table and spreadsheet are correct
But I'm still getting "Invalid outside procedure" on acExport
 
hhhhhhhhmmmmmmmmmmm?????????
I've never seen that. Have you checked your references to be sure you have
Microsoft Excel 9.0 Object Library checked?
 
Klatuu said:
Yes, but I saw two problems:
1. The last argument in your action is not allowed for exports. It is
only
for imports so you can identify exactly what data from a workbook you
want.
I read somewhere there is a way to trick it, but I don't know what it is.

Though not documented and Help file says it's not possible, it appears that
you can specify the Range argument for exports. Syntax is exactly the same
as that used for imports.
 
The debugger can get confused about the exact position of
an error on a line. If you can't see an error, look to the
left. Are you sure that you are inside a procedure?

(david)
 
Back
Top