I work with Excel spreadsheets that use the vba Erl() function for error handling. The vba code might look something like this:
Sub doSomething()
Dim v as variant
Dim v1 as Variant
On Error goto err_Handler
10 v = "Test"
20 v1 = 1/0 ' Generate error
30 Call doMoreStuff()
Exit Sub
err_Handler:
if Erl = 20 then
Resume Next ' Ignore this error
Else
Msgbox "Looks Like there is a REAL error somewhere. Desc = " & Err.Description
End If
End Sub
I am not making a judgement about using Erl in this way. Personally, I never do, but we have many spreadsheets that have this.
However, in O365 testing on 64 bit Excel it seems like this functionality does not work at all. In the above code, the program does not read the line number correctly and so the line Erl = 20 returns False when it should be True and hence the program calls the Msgbox when it should ignore the error.
Has anyone else noticed this? There are apparently dozens of spreadsheets that have this potential issue. Creating a script that would somehow change the code to something else would be a huge undertaking.
Has anyone else had to deal with this problem and can you outline how you addressed this problem?
Thanks very much