0
I have an application running in VBA, in it I have an error treatment that works perfectly the first time the action goes through it, but it is inside a For Each loop and the second time it simply ignores the treatment, I don’t know if I’m missing a detail or if it just doesn’t rotate when called twice on a loop or something, someone knows the reason for it. Below this part of the code that is giving that error.
On Error GoTo Erro
namePdf = doc3.Document.all.tags("font")(8).innerText
For Each exibirDoc In doc2.Document.all.tags("img")
ver = exibirDoc.src
If ver = "https://pan.interfile.com.br/imagens/FileSearch.gif" Then
exibirDoc.Click
Exit For
End If
Next
You are forgetting the most important thing, fix the mistake. If it continues there is nothing to do more. There is a great way to help, take the "treatment" of error and let it be shown. https://answall.com/questions/tagged/exce%C3%A7%C3%a3o? Sort=votes&pageSize=50
– Maniero
I need him to stay Maniero, I don’t like to use him, but in this case I had to use.
– M. Marins
What is the complete code that handles the error?
Erro:– Evert
Elvis, in reality does not have a specific treatment for this error, I just want him to redirect the execution to certain part of the algorithm, so that it continues without crashing the program understands.
– M. Marins
What’s the part of the code where the most errors occur? And as @Elvis said, you need to do the
Erro:, because when the crash occurs, you’re telling the code to jump toErro:, but there is no codeErro:... Behold in this answer where, in the event of an error, it leaves theSub, but you can also put aExit Forin case of error. For more information, you have an English tutorial on this– danieltakeshi
@danieltakeshi I’ll explain better, I have an application that search for certain documents on a specific site, but when the site does not find documents for downloads, it returns me a popup saying it does not have, this is when the program error, And the best way I could figure out how to fix this is to use Goto. But I’ve already found a way to fix this.
– M. Marins