Error Trapping

S

Steven M. Britton

I have a module that calls an Excel workbook then imports info based on
criteria of a filter applied. Below is a cut out of the code, but the
problem is Access doesn't see the error that Excel is producing. I can't for
the life of me figure out how to get the error number and/or description from
Excel back into Access so I can write an event to handle/ignore it... HELP?

Set xlsApp = CreateObject("Excel.Application")

xlsApp.Visible = False

xlsApp.Sheets("Master BOM Sheet").SELECT
'Set my filter based on Quarter requested.
xlsApp.Selection.AutoFilter Field:=3, Criteria1:=strCriteria1,
Operator:=1, Criteria2:=strCriteria2
End_Row = xlsApp.Cells(xlsApp.Rows.Count, 1).End(-4162).Row
xlsApp.Range(xlsApp.Cells(26, 1), xlsApp.Cells(End_Row,
38)).SpecialCells(12).SELECT
'Replace Characters that will cause the APPEND Query to fail
On Error Resume Next ' This is the problem line and/or area...
xlsApp.Selection.Replace What:="""", Replacement:="''", LookAt:=2,
SearchOrder:=1
xlsApp.Selection.Replace What:="#N/A", Replacement:="NA", LookAt:=2,
SearchOrder:=1
On Error GoTo Error_Handling
 

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