特に目新しいという訳ではないですが、すでに起動しているIEのオブジェクトを取得する方法を紹介
'■ vbsで指定タイトル・URLの起動中IEのオブジェクトを取得
Function getObjIE(Key)
Dim KeyWord, ie, Reg
Set ie = Nothing
Set Reg = CreateObject("VBScript.RegExp")
Reg.Pattern = ".*" & Key & ".*"
On Error Resume Next
For Each obj In CreateObject("Shell.Application").Windows
If TypeName(obj.Document) = "HTMLDocument" Then
If Reg.Test(obj.LocationName) Or Reg.Test(obj.LocationURL) Then
Set ie = obj
End If
End If
Next
On Error GoTo 0
Set Reg = Nothing
If ie Is Nothing Then
MsgBox "指定のieが見つかりませんでした。"
Else
Set getObjIE = ie
End If
End Function
getObjIE(Key) KeyにWindowタイトルかURLどちらかに含まれるキーワードを指定すると、対象のIEオブジェクトが返ってきます。
正規表現使って、URLとかタイトルでユニークな部分のみを指定すればよくなっているのが優しい。