By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,709 Members | 2,155 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,709 IT Pros & Developers. It's quick & easy.

TransferSpreadsheet, word automation; 'Error 0'

P: n/a

When executing DoCmd.TransferSpreadsheet to an .xls file that's being
used as a datasource for a Word mail merge document, if that Word
document is currently open, the TransferSpreadsheet action fails with
an 'Error 0'. I have tried different methods of trapping that error,
and I still cannot get my app to indicate that the user should exit
Word: I have tried disabling the error handler before DoCmd is called,
looking for an Err object after the call, and then using Err.Raise to
generate a custom error:

On Error Resume Next
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
tblName, xlsPath, , "DP_table"
If Err Then
Err.Raise 811, "Document pump", Err.description & vbCrLf &
"(note: Word may have crashed, leaving the file locked; killing the
WINWORD.EXE task may solve this)."
End If
On Error GoTo error_exit

.... but this does not work: still Error 0. If I do not disable the
error handler, DoCmd never reaches the Err.Raise statement, leaving me
with Error 0 again.

I have tried determining whether or not the Word document is open
(using methods of the Word automation objects) but it didn't work for a
non-admin user (which is a problem).

Please note that I am properly exiting my function before the error
handler (most posts on this board regarding Error 0 were due to this).

Does anyone have any suggestions?

Thanking you kindly in advance,
Robert Waters

Sep 27 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.