I’m needing to troubleshoot some old VB6 code and I’m confused about the use of “On Error”. In the sample below, if I surround the specific line of code I want to test with the On Error GoTo and the ErrHandler1, is that the ONLY line that’s tested. Or will the divide by Zero be included if it’s in the same Sub?
On Error GoTo ErrHandler1
If Not Exists(BaseDirectory + "\ARCHIVE") Then _
MkDir BaseDirectory + "\ARCHIVE"
ErrHandler1:
Call MsgBox(Err.Number & vbCrLf & Err.Description, vbExclamation, App.Title)
intValue1 = 12
intValue2 = 0
intValue3 = intValue1 / intValue
Thanks.
The divide by zero will be included and handled, and it will probably create a loop in your sample…
The correct approach is like that