Excel 网页关闭弹窗求助

如题所述

With CreateObject("InternetExplorer.Application")
.Visible = True
.Navigate "http://www.xxx.com"
While .busy Or .readystate <> 4: Wend
Set objScr = .document.createElement("script") ‘创建一个脚本元素
objScr.Text = "window.confirm=function(x){return true;};" 'true是点击“确定”,false是点击“取消”
.document.body.appendChild objScr '将脚本元素添加到body里
.document.getElementById("submit").Click
.Quit
End With

在Navigate后、Click前,添加如上蓝色部分代码,以屏蔽confirm弹出框。

其实最好是用xmlhttp或winhttp从后台获取网页数据。IE控件有太多情况发生,不好控制。
温馨提示:答案为网友推荐,仅供参考
相似回答