当打开一个IEpopup框时停止VBA停止并closurespopup警告框

这个真气popup框让我困扰了2个月,有些人帮我克服了这个问题。

我写了一个代码,当点击这个链接时,点击我的网页中的锚链接,通常会导航到下一页。 如果点击链接页面上的数据没有正确提供,它会打开一个popup框,在那里我的VBA代码停止,直到我点击确定popup框(为什么我的VBA代码停在这里?)。 此外,我需要使用我的VBAclosures此button并更正数据,然后再次单击链接。 我已经尝试了以下解决scheme,他们似乎没有太多的灵丹妙药。 1.删​​除onclick属性( http://www.mrexcel.com/forum/excel-questions/426740-using-visual-basic-applications-close-internet-explorer-message-box-popup.html )这甚至不工作如果它适用于我的情况nt 2.发送密钥 – 进入nt确定为什么人们甚至把这张贴作为一个解决scheme。我的代码在链接被点击后很快停止,代码永远不会到达行发送密钥,直到popup我手动安装。

3.点击链接并运行新的excel中的代码closurespopup窗口并closures它,然后再打开另一个excel( http://www.vbaexpress.com/kb/getarticle.php?kb_id=1146 )工作,但我需要单击该链接差不多500个时间,这使得代码打开excel工作表每时每刻,这看起来笨拙,耗时的过程消耗和不可行有人可以告诉我一种方法来closures对话框,为什么地狱有人发明了这个警报箱。

这是我的代码

while x>1 'Fill the details in webpage Set TDelements = IEfr1.getElementsByTagName("a") For Each TDelement In TDelements If TDelement.innerText = "Next" Then ' TDelement.Focus ' Call BeginTimer(500, IE.hwnd) TDelement.Click '//this makes the alert box fire and code halts here until the box is closed 'TDelement.setAttribute "onclick", "return true" TDelement.FireEvent ("onClick") TDelement.FireEvent ("onsubmit") ' Application.Wait (10000) While IE.Busy Or IE.readyState <> READYSTATE_COMPLETE: DoEvents: Wend End If Next 

循环