我的目标是将同一网站上多个网页上的数据抓取到Excel中。我在IE8的标签页中打开了这些页面。我没有打开其他IE窗口。
我已经尝试了以下方法来打开IE:
AppActivate "Microsoft Internet Explorer provided by [my company]"
' It loses focus, the titlebar flashes for a fraction of a second
' .. another code ..
Dim ShellApp
Set ShellApp = CreateObject("Shell.Application")
Dim ShellWindows
Set ShellWindows = ShellApp.Windows()
Dim i
For i = 0 To ShellWindows.Count - 1
If InStr(ShellWindows.Item(i).FullName, "iexplore.exe") <> 0 Then
Set IEObject = ShellWindows.Item(i)
End If
Next
' Did absolutely nothing, grabbed this code from another solution on stackoverflow
Run Code Online (Sandbox Code Playgroud)
我还尝试了GetObject(我不想使用CreateObject方法),如下所示
dim ie As InternetExplorer …Run Code Online (Sandbox Code Playgroud)