I've received the following code to add to a closed code (protected by password) so an error can be catch.
On Error Resume Next: Err.Clear
Application.SetOption "Error Trapping", 2
strLine = Application.Run("Comdinheiro.xlam!ExecutaURL_Cliente2", "Fundamentalista3-0-" _
& strData & "-0-" & strCODIGO_CVM & "-" & strDF & "-IFRS-comdinheiro-1")
If Err.Number <> 0 Then
Sleep i * 500 'Espera 0.5 us antes de executar novamente a função com problema
Err.Clear
On Error GoTo 0
strLine = Application.Run("Comdinheiro.xlam!ExecutaURL_Cliente2", "Fundamentalista3-0-" _
& strData & "-0-" & strCODIGO_CVM & "-" & strDF & "-IFRS-comdinheiro-1")
End If
1- Application.setOption "Error Trapping", 2 : Is there any Erro trapping option in VBA? I couldn't find it online.
2- On Error Resume next: Err.clear : I've seen On Error Resume next, or On Error Resume but never something like that.
Can someone explain me points 1 and 2.