+ -
当前位置:首页 → 问答吧 → VBA 关闭指定网页 出错

VBA 关闭指定网页 出错

时间:2011-08-12

来源:互联网

从网页上搜到一段代码,运行时出错(红色部分处),不知何故:
Sub GetIEWindows()
    Dim shellWd As ShellWindows
    Dim iewd As InternetExplorer
    Set shellWd = New ShellWindows
    For Each iewd In shellWd
        If TypeOf iewd.Document Is HTMLDocument Then
            Debug.Print iewd.Document.URL
            If iewd.Document.URL = "http://www.baidu.com/" Then
                iewd.Quit
            End If
        End If
    Next
    Set iewd = Nothing
    Set shellWd = Nothing
End Sub
虽已引用了 Microsoft Internet Controls 和 Microsoft HTML Object Libary,仍提示:
运行时错误 '-2147467259 (80004005)’:
自动化 (Automation) 错误
    请高手指点 ,谢谢 !

作者: gfs57   发布时间: 2011-08-12

自己顶一下,请高手出招 !

作者: gfs57   发布时间: 2011-08-12

你是不是不是IE的浏览器?是遨游吧还是?

作者: xmyjk   发布时间: 2011-08-12

引用:
原帖由 xmyjk 于 2011-8-12 12:45 发表
你是不是不是IE的浏览器?是遨游吧还是?
谢谢高手 ! 是 360 的,这样是不是有区别 ?

作者: gfs57   发布时间: 2011-08-12