Set objShellApp = CreateObject("Shell.Application")
Dim winFolder
For Each wFolder In objShellApp.Windows
On Error Resume Next
isFolder = wFolder.document.folder ' An IE window does not support ".document.folder". We get the first Windows Explorer window.
If Err = 0 Then
wFolder.Visible = True
Set winFolder = wFolder
Exit For
End If
Next
一定有更好的方法来区分 Windows-Explorer 和 Internet-Explorer。
我将非常感激你的帮助。
答案1
代替
On Error Resume Next
isFolder = wFolder.document.folder
If Err = 0 Then
和
If(wFolder.FullName = "C:\Windows\Explorer.EXE") Then