My goal is to scrape data off multiple webpages on the same site into Excel. I have these pages open in tabs within IE8. I have no other IE windows open.
I have trie
OK, so I notice a potential problem with the first method you attempt using the Shell object.
You may have an incorrect value for the .FullName
property. (when I debug and examin the ShellWindows
collection, I see path ""C:\Program Files (x86)\Internet Explorer\"
Function GetIE() As Object
Dim ShellApp as Object, ShellWindows as Object, i as Long
Dim IEObject As Object
Set ShellApp = CreateObject("Shell.Application")
Set ShellWindows = ShellApp.Windows()
For i = 0 To ShellWindows.Count - 1
If InStr(ShellWindows.Item(i).FullName, "C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE") <> 0 Then
Set IEObject = ShellWindows.Item(i)
Exit For 'No need to continue....
End If
Next
If IEObject Is Nothing Then Set IEObject = CreateObject("InternetExplorer.Application")
Set GetIE = IEObject
End Function
You can put this function in your code, just tuck it away somewhere, then whenever you need IE you can call it like: