Error in code exportin tables to excel

S

sebastico

I'm tryin to export a table to excel with the code:

Private Sub Command4_Click()
On Error GoTo Err_Command0_Click

Dim stDocName As String
stDocName = "F01_UT"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, F01_UT,
"C:\TRY\Tbls", True
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub

However, Access displays the message:
Compile error :
Syntax error

What I'm doing wrong? If I want to export more tablas do I have to write
more lines (DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9) for
each table.

Many thanks
 

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