Re: DoCmd.TransferSpreadsheet acExport, problem

Hello Doug,
Thanks for the reply. Yes the arguments are variables.
As I mentioned the code is in fact creating the new worksheet in the
spreadsheet and inserting the first line (the headers/field names)
from the data table. So it seems to be able to recognise the table,
find the spreadsheet, create the new worksheet and insert the header
row, then give up and tell me it cannot find the table? There is some
400 records in the table it seems not to want to move. I have checked
references, and compacted the mbd. Bizarre!

I have reverted back to an older version of this front end and it is
working okay. (It has had several revisions of other reports etc
since, but not this particular one). It works okay.
From what I can find searching error 3011 I see references to corrupt
databases etc. I will copy/ recreate this report code into a new
module in a new mbd first and then bring it back in.


On May 7, 12:01 am, "Douglas J. Steele"
<NOSPAM_djsteele@xxxxxxxxxxxxxxxxx> wrote:
As you're written it, I'm not surprised it won't work. The 3rd and 4th
arguments (where you have [ReportData] and [ReportName]) are supposed to be
string expressions.

If ReportData and ReportName are variables that contain the name of the
table and the full path to the spreadsheet to which you're trying to export,
try removing the square brackets from around them.

If ReportData is actually the name of the table, put it in quotes.

DoCmd.TransferSpreadsheet acExport, 8, "ReportData", "C:\ReportName.xls"

Note that if you do not put a full path in front of the spreadsheet name,
you may have problems finding the resulting spreadsheet, as it will be
written to the current directory, which usually is not the directory where
your MDB resides.

Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)

"Piri" <wiremu.pare...@xxxxxxxxxxx> wrote in message


I am using the following to transfer the contents of a table into an
existing spreadsheet (as a new worksheet).
This has worked for me previously.

DoCmd.TransferSpreadsheet acExport, 8, [ReportData], [ReportName]

where ReportData is the linked table name in the local database and
ReportName is the full path and file name of the spreadsheet.

I am getting Error "3011 - The Microsoft Jet database engine could not
find the object 'ReportData'. Make sure the object exists and that you
spell its name and the path name correctly."

The table does exist - the irony is that the worksheet is created in
the spreadsheet but only the field names from the table appear but no
other data? The data definitely exists in the table.
Why would it create the worksheet with the first line only of the
access table, and not include the rest of the data?
Am I doing anything wrong?



Relevant Pages

  • RE: Excel project, need help
    ... LotsOfTabs.xls is the name of the "different spreadsheet ... When you are talking about a tab, you really mean a worksheet ... The part#s start in cell C2 and go down to cell C10 ... Sheet1 should be changed to the name of the first of the 30 tabs of data ...
  • Re: Embed Excel Spreadsheet in PowerPoint and Show Its Multiple Worksh
    ... Since copy and paste as XL object embeds then entire workbook you want ... a small range of that worksheet each time. ... without the whole spreadsheet being replicated for each view. ... cannot use object linking, only object embedding. ...
  • Re: Export to Excel
    ... spreadsheet and I am using TransferSpreadsheet to create a new Excel ... worksheet name in the process i.e. to name it something other than ... Then change the name back again to "qryName" after ... Dim strNewName As String ...
  • RE: Resume.xlw and closing workbook with VBA code.
    ... The spreadsheet is not "linked" ... Example is EAST, NORTH, SOUTH, WEST, stores are on one worksheet in the ... you no longer need to open up another excel data sheet. ... .Selection.Borders.LineStyle = xlNone ...
  • RE: linking between spreadsheets
    ... This is really a job for a VBA macro. ... language that you can get to from the worksheet by typing ALT-F11. ... Create a summary workbook where you place the macro. ... spreadsheets, to one master spreadsheet. ...