Vista以降で、現在または最後にアクティブなシェルを捕捉する。
Win32APIのFindWindow()を併用すれば、正確に捕捉できます。
hwnd=CreateObject("Excel.Application").ExecuteExcel4Macro("CALL(""user32"",""FindWindowA"",""JCJ"",""CabinetWClass"",0)")
For Each ie In CreateObject("Shell.Application").Windows()
If ie.hwnd=hwnd Then Exit For
Next
If IsEmpty(ie) Then
MsgBox "Not Found"
Else
MsgBox ie.Document.Folder.Self.Path
End If
« インターネットエクスプローラの起動スイッチ | トップページ | Vista+IE8(IE7?)で、制限付きサイトゾーンのフォルダが使える。 »