hi,
i want to get controll on already opened interent explorer using vba. when i use below coding i am getting error meesage "Acitvex compontent cant creat object"
regards,
jagu143
i want to get controll on already opened interent explorer using vba. when i use below coding i am getting error meesage "Acitvex compontent cant creat object"
Code:
Sub main()
Dim browsers
Set browsers = GetBrowsers
Dim browser
Dim url
For Each browser In browsers
url = browser.******************.href
Debug.Print CStr(url)
Next browser
End Sub
Public Function GetBrowsers() As Collection
Dim browsers As New Collection
Dim shellApp As Shell32.Shell
Dim wnds As SHDocVw.ShellWindows
Set shellApp = CreateObject("Shell.Application")
Set wnds = shellApp.Windows
Dim i As Integer
Dim ie As SHDocVw.WebBrowser
Dim name
For i = 1 To wnds.Count
Set ie = wnds(i)
If ie Is Nothing Then GoTo continue
If UCase(ie.FullName) Like "*IEXPLORE.EXE" Then
browsers.Add ie
End If
continue:
Next i
Set GetBrowsers = browsers
Set shellApp = Nothing
End Function
jagu143
Last edited by a moderator: