For Each requires a Next at the other end
If I understand correctly what you are trying to do you need to move the Do and the Sleep above the For Each and add a Next before the Loop. You may also want to put an Exit For in there when you find your match.
Code:Dim emailpageelements As HtmlElementCollection = WebBrowser2.Document.GetElementsByTagName("a") Dim complete = True Do System.Threading.Thread.Sleep(6000) For Each emailver As HtmlElement In emailpageelements If InStr(emailver.InnerHtml, "https://twitter.com/account/confirm_email/") Then complete = True Exit For End If Next Loop Until complete




Reply With Quote
