Access 2003 appexcel warning message

greebo

Registered User.
Local time
Today, 01:13
Joined
Apr 17, 2009
Messages
17
The Problem: I have an unattended database (triggered by scheduler) which imports excel files into access after checking the contents and format, but the process halts at "appExcel.Workbooks.Open" if it is unable to open the file - such as a zip file changed from .zip to .xls (I'm not joking!)

Is there an equivalent command to "DoCmd.SetWarnings False" for "appexcel" in access 2003. if I can avoid the error message, the rest of the code handles the problem


any advice would be appreciated


Thanks
 
Without seeing your code I'd say:
On Error Resume Next
...your open code...
On Error Resume 0
 
Thanks for your quick response

The actual code is:

Dim appExcel As Object
Set appExcel = CreateObject("Excel.Application")
appExcel.Workbooks.Open "d:\imports\tesfile.xls, UpdateLinks:=0

stepping over the 3rd line gives:

"This file is not in a recognizable format", etc, etc with [OK] and [Cancel]

I want to suppress this entirely or trap it into a string variable and save it as an error message, without having to physically intervene to click an option

The error trapping is saving "1004 OPEN METHOD OF WORKBOOKS CLASS FAILED"

Ideally the pc will run access periodically and process new uploads without ever needing supervision. This seems to be the final hurdle.

Is there a way to recognize the error number before the message is displayed and thus skip the line?

Thanks again for your help
 
Code:
If err.number = 1004 Then
    Resume Next
Else
    GoTo ErrorHandler 'Replace with your normal error handling label
End IF
 
Or:

Code:
ErrorHandler:
If err.number = 1004 Then
    Resume Next
End IF
'...Your Error Handling Code
 

Users who are viewing this thread

Back
Top Bottom