Error 213

Writing to Excel Spreadsheet Code:

Function RPT_SnapShot(WhichReport,Tstatus,Sby,Sd,Ed)

On Error 213 Goto EarlyStop

Working code here

GetFormat:

Call PGM_XLFormatting(xlApp, xlWorkbook, xlsheet,status,TOselect,TOfilterBy,startdate,endDate,WhichReport,collected)

End With

TheEnd:

Set xlsheet = Nothing

Set xlWorkbook = Nothing

Set xlApp = Nothing

Print MessageAllDone

Sleep 3

Exit Function

EarlyStop:

Msgbox “Error” & Error$ & " Line: " & Erl

Resume GetFormat

End Function

Problem:

When a user clicks inside an Excel Cell it causes an error 213 to occur. This error displays under the excel spreadsheet and then must be clicked for the final formatting to occur. How can I get this MsgBox to display on top?

Required:

Spreadsheet must be visible at all times and cannot prevent user from causing the 213.

Subject: Error 213

Finally figured it out…

Removed the error messagebox and

in the first line of the “Resume GetFormat” Call

I added “sleep 1” .

This prevented any error displaying and then ran the formatting code.

I thought it was a window focus problem but was just a timing issue.