问题:我目前遇到了一些问题,关闭一个没有内容的“过早”互联网窗口。退出错误Internet Explorer窗口
基本上,如果这种“早熟”窗口打开时,我的宏不设法选择我感兴趣的窗口,但只要我手动关闭此“早熟”的窗口,我可以正确运行我的代码。 它的来源来自一个小错误,它以某种方式打开它,但除了那个窗口不影响其余的代码。
测试完成:
Dim Widow As Object, page_foireuse As SHDocVw.InternetExplorer
Dim objShell As Object
Set objShell = CreateObject("Shell.Application")
MsgBox objShell.Windows.Count
' MsgBox objShell.Windows(0).document.Title
' MsgBox objShell.Windows(1).document.Title
' MsgBox objShell.Windows(2).document.Title
' MsgBox objShell.Windows(3).document.Title
' MsgBox objShell.Windows(4).document.Title
' MsgBox objShell.Windows(5).document.Title
' MsgBox objShell.Windows(6).document.Title
'For Each Widow In objShell.Windows
' If Widow.document.Title Is Nothing Then ' this doesn't work
' Set page_foireuse = Widow
' End If
'Next
'
'If objShell.Windows(5).document.Title Is Nothing Then
'End If
Set page_foireuse = objShell.Windows(5)
page_foireuse.Quit
MsgBox objShell.Windows.Count
结果至今:
- 当我算在shell窗口的数量,这种 “早熟” 窗口也算
- 当我返回每个计数窗口的位置或标题时,在尝试返回“提前”窗口的位置或标题时出现错误
- 两个循环我试图在这一端运行没有工作
所以我的问题是:如何通过关闭这个“早熟”窗口宏?
你什么错误,在哪里(哪一行代码)? – dee
当我尝试msgBox这个页面的标题它不起作用,错误描述返回_Automation错误,未指定错误_ – Seb