TransferSpreadSheet

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

Guest

Trying to export a query to excel and am getting an error (Compile Error:
Expected Expression). Can anyone pinpoint the problem

Private Sub CmdRunExcel_Click()
DoCmd.TransferSpreadsheet(acExport,acSpreadsheetTypeExcel9,"QryExportPriority", "C:\Documents and Settings\595930\Desktop\STI Reports\Export.xls",)
End Sub
 
remove the comma at the end of the arguments, directly in front of the
closing parenthesis.

hth


Rafi said:
Trying to export a query to excel and am getting an error (Compile Error:
Expected Expression). Can anyone pinpoint the problem

Private Sub CmdRunExcel_Click()
DoCmd.TransferSpreadsheet(acExport,acSpreadsheetTypeExcel9,"QryExportPriorit
y", "C:\Documents and Settings\595930\Desktop\STI Reports\Export.xls",)
 
Tina - Thanks for your help. I removed the comma, carelessness, and now the
error message is "Compile error: Expected: = ; I have no idea where the equal
sign (=) fits in.

Thnaks
 
You don't need the parentheses at all:

DoCmd.TransferSpreadsheet
acExport,acSpreadsheetTypeExcel9,"QryExportPriority", "C:\Documents and
Settings\595930\Desktop\STI Reports\Export.xls"
 
Works like a charm!!!!!!! Thanks

Ken Snell (MVP) said:
You don't need the parentheses at all:

DoCmd.TransferSpreadsheet
acExport,acSpreadsheetTypeExcel9,"QryExportPriority", "C:\Documents and
Settings\595930\Desktop\STI Reports\Export.xls"
 
Back
Top