to get the HTML Document of an opened IE i use the following code:
Function getOpenIEByTitle(Title As String) As InternetExplorer
On Error Resume Next
Dim sh As Object
Set sh = CreateObject("Shell.Application")
For Each getOpenIEByTitle In sh.Windows
If TypeName(getOpenIEByTitle.document) = "HTMLDocument" Then
If getOpenIEByTitle.document.Title = Title Then
Exit Function
End If
End If
Next
End Function
This works fine!
BUT:
I can't find the Window if i start a *.website-File with "iexplore.exe" -w "*.website"
Can some one help me?
Are there other solutions?
Can i get the HTMLDocument of any running iexplore.exe if i can provide the right PID?
Creating a new InternetExplorer-Application is not a solution for my environment. Or can i start a pinned Website from VBA?
If you know URL or part of URL try this:
Public Function GetIEInstance(URLAddress) As SHDocVw.WebBrowser
Dim objShellWindows as ShDocVw.ShellWindows
Dim ShellWindow as ShDocVw.WebBrowser
Set objShellWindows = new ShDocVw.ShellWindows
For Each ShellWindow in objShellWindows
If InStr(ShellWindow.Name, "Internet Explorer") > 0 Then
If ShellWindow.LocationURL Like "*" & URLAddress & "*" Then
Set GetIEInstance = ShellWindow.Application
Exit Function
End If
End If
Next ShellWindow
End Function
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.