
How to close all explorer folders without closing IE windows?
Open a few IE and Explorer windows and run a test script that just displays what TypeName()
returns...
And you're right about removing elements of the ...Windows collection while enumerating it causing
problems. You had that part right in your 1st post ;-)...
--
Michael Harris
Microsoft.MVP.Scripting
--
Please do not email questions - post them to the newsgroup instead.
--
Quote:
> Excellent! Thanks Michael. There's one problem though, it doesn't work
> completely. Apparently as windows close the Shell.Windows list
> contracts so the indexing gets out of sync. I think you have to save
> the Shell.Windows list in an array and use that to close the folders
> don't you think? Btw, where did you get the "IShellFolderViewDual"
> information? I have MSDN Library (Jan 2000) and it's not in there
> anywhere!
> Mike
> >Dim oShell, oShellWindows, oShellWindowsList()
> >Set oShell = CreateObject("Shell.Application")
> >Set oShellWindows = oShell.Windows
> >For Each oWindow in oShell.Windows
> > '
> > '...Explorer --> IShellFolderViewDual
> > '...IExplore --> HTMLDocument
> > '
> > If TypeName(oWindow.Document) = "IShellFolderViewDual" Then
> > oWindow.Quit
> > End If
> >Next
> >--
> >Michael Harris
> >Microsoft.MVP.Scripting
> >--
> >Please do not email questions - post them to the newsgroup instead.