Automation Development in VBA - Error Handling in Loop

-2

I'm developing a VBA automation that accesses a certain site and takes some information from it, but I'm having a problem with it.

The site (Santander - Benner) is very badly done, many parts were built in a way that seems to mend with what they had already done, ie they just added more features and did not configure the whole project.

Going straight to the point, I wanted to know if there is any way to work with the GoTo error handling in the form of a loop .

Example: While an error occurs, do ... or, it is an error, go back to "x" line and do the procedure until you get to this checker again, if you have an error again, go ... I do not know if you make it clear, but it is to do GoTo in a loop.

    
asked by anonymous 19.06.2018 / 15:15

1 answer

2

After reviewing this , and some other searches, I found a solution.

continue:
     'seta variavel operacao
     Set operacao = ie.document.getElementById("tsk_toolbar")

     'continua caso tenha erro
     On Error Resume Next

     'recebe o valor caso tenha dito erro
     va = Err.Number

     'verifica se teve erro, valor diferente que zero
     'caso tenha, retorna e seta novamente 
     If va <> 0 Then
          GoTo continue
     Else
          'nao faca nada
     End If

Just explaining again why, and not just treating the error itself. The site that I am working on is very bad to do automation, and this error happens because the page takes a lot to load, so finding another way to solve this problem, I created this form, which solves my problem.

    
19.06.2018 / 18:01