C
Cathy
I'm using Access 2007 on an Access 2003 formatted database.
I have recently had to add a column of information to some code that outputs
to excel. On a button, I have a first query that deletes the contents of a
table. Then next query refills the contents of the same table. Then I
export the table to a tab on a spreadsheet.
The table empties and refills properly. My problem is when moving the data
to excel. My original code looked for the field titles, and I have tried
ammending it not to look for field titles. Either way the code blanks out
the titles, refuses to move the data and locks up on the error "Cannot Expand
Named Range". I don't even use named ranges...
Here's my code:
' Runs Delete Query
DoCmd.OpenQuery "qryPCETotalEntries DELETE", acNormal, acEdit
' Runs Append Table Query
DoCmd.OpenQuery "qryPCETotalEntries APPEND", acNormal, acReadOnly
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"PCETotalEntries", "C:\SopaReport.xls", False, ""
What can I do to correct this error?
Thank you in advance,
Cathy
I have recently had to add a column of information to some code that outputs
to excel. On a button, I have a first query that deletes the contents of a
table. Then next query refills the contents of the same table. Then I
export the table to a tab on a spreadsheet.
The table empties and refills properly. My problem is when moving the data
to excel. My original code looked for the field titles, and I have tried
ammending it not to look for field titles. Either way the code blanks out
the titles, refuses to move the data and locks up on the error "Cannot Expand
Named Range". I don't even use named ranges...
Here's my code:
' Runs Delete Query
DoCmd.OpenQuery "qryPCETotalEntries DELETE", acNormal, acEdit
' Runs Append Table Query
DoCmd.OpenQuery "qryPCETotalEntries APPEND", acNormal, acReadOnly
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"PCETotalEntries", "C:\SopaReport.xls", False, ""
What can I do to correct this error?
Thank you in advance,
Cathy