既に開いているIEのオブジェクトを取得する方法

http://q.hatena.ne.jp/1198653307ExcelVBAVBScriptで、InternetExplorerをCreateObjectして扱うように、既に開いているInternetExplorerを取得して扱うことが出来る方法。


Sub test56()
Dim oSH,oIE,oMyIE
Set oSH = CreateObject("Shell.Application")
Set oMyIE = Nothing

For Each oIE In oSH.Windows
If InStr(oIE.FullName,"iexplore.exe") > 0 Then
Set oMyIE = oIE
Exit For
End If
Next


If oMyIE Is Nothing Then Exit Sub
oMyIE.Navigate "http://www.yahoo.co.jp/"
Set oMyIE = Nothing
End Sub