「その後のFor文ループは、そのshellの仲間ひとつひとつに対して処理するためのもの」
'サンプル1.3.1_既に開かれているInternetExplorerを取得する
Public Sub getIE()
Dim ie As Object 'IEを格納する変数(オブジェクト型)
Dim sh As Object '起動中のShellWindow一式を格納する変数
Dim win As Object 'ShellWindowを格納する変数
'起動中のShellWindow一式を変数winsに格納
Set sh =
CreateObject("Shell.Application")
'ShellWindowから1つづつ取得して処理
For Each win In sh.windows
'タイトルバーにGoogleが含まれるかチェック
If
InStr(win.Document.Title, "Google") > 0 Then
'変数ieに取得したwinを格納
Set ie = win
'ループを抜ける
Exit For
End
If
Next
'URLを表示する
MsgBox ie.LocationURL
End Sub