Export to excel error

prabhus

Registered User.
Local time
Today, 15:39
Joined
Mar 14, 2012
Messages
67
Hi All,

When i use the following code and call this in macro with Runcode function,i get a error msg stating, " you cancelled the previous operation "
please help

ExporttoExcel
'
'------------------------------------------------------------
Function ExporttoExcel()
On Error GoTo ExporttoExcel_Err
' Customer Report
DoCmd.OpenQuery "Customer Report", acNormal, acEdit
DoCmd.OutputTo acOutputQuery, "Customer Report", acFormatXLS, "L:\Customer\Customer Report " & Format(Date, "DDMMMYYYY") & ".xls", , ""

ExporttoExcel_Exit:
Exit Function
ExporttoExcel_Err:
MsgBox Error$
Resume ExporttoExcel_Exit
End Function
 
I assume it's on the OutputTo line, but you can temporarily comment out the "On Error..." line and try to run it. Does the query open without error? Can you access that path?
 

Users who are viewing this thread

Back
Top Bottom