View Full Version : VBA Get InternetExplorer Object
pundabuyer
11-09-2008, 02:09 PM
Hi Guys,
Now we have the vba code able to retreive data from a webpage is there anyway to start the vba code doing this from an internet explorer window that is already open?
Perhaps a reference by window title? e.g this one is called:
"VBA Express Forum - Post New Thread - Windows Internet Explorer"
:beerchug: Thanks
Demosthine
11-09-2008, 05:00 PM
Good Afternoon.
Because of the connectivity involved with Internet Explorer and it's ability to run ActiveX Controls and COM Objects, using GetObject is not permitted. As you've seen in your other posts, CreateObject is completely legitimate, however.
As with almost everything, there is a workaround using the Shell Object.
References:
Microsoft Internet Controls
Microsoft Shell Controls and Automation
Sub GetInternetExplorer()
Dim appShell As Shell
Dim appIE As InternetExplorer
Dim appWindow As appect
Set appShell = New Shell
For Each appWindow In appShell.Windows
If TypeName(appWindow.Document) = "HTMLDocument" Then
Set appIE = appWindow
Debug.Print appIE.Name & ": " & appIE.LocationURL
End If
Next appWindow
End Sub
Enjoy.
Scott
Demosthine
11-09-2008, 05:00 PM
Good Afternoon.
Because of the connectivity involved with Internet Explorer and it's ability to run ActiveX Controls and COM Objects, using GetObject is not permitted. As you've seen in your other posts, CreateObject is completely legitimate, however.
As with almost everything, there is a workaround using the Shell Object.
References:
Microsoft Internet Controls
Microsoft Shell Controls and Automation
Sub GetInternetExplorer()
Dim appShell As Shell
Dim appIE As InternetExplorer
Dim appWindow As appect
Set appShell = New Shell
For Each appWindow In appShell.Windows
If TypeName(appWindow.Document) = "HTMLDocument" Then
Set appIE = appWindow
Debug.Print appIE.Name & ": " & appIE.LocationURL
End If
Next appWindow
End Sub
Enjoy.
Scott
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.