我正在尝试连接已经打开的IE窗口,但我在第二行有一些问题
Run time error 429 ActiveX Component can't create object
我添加的引用仍然无法访问IE窗口。以下是代码。
Sub A()
Set objShell = CreateObject("Shell.Application")
IE_count = objShell.Windows.Count
For x = 0 To (IE_count - 1)
my_url = objShell.Windows(x).Document.Location
my_title = objShell.Windows(x).Document.Title
if my_title Like "Put your webpage title here" & "*" Then
Set ie = objShell.Windows(x)
Exit For
Else
End If
Next
End Sub
答案 0 :(得分:0)
两件事 -
IE_Count
IE_count = objShell.Windows.Count
应为IE_count =
objShell.Windows().Count
。请参考 -
https://msdn.microsoft.com/en-us/library/windows/desktop/bb773969(v=vs.85).aspx
希望纠正这些将使您的代码正常工作