Close and Save All but the Active Document

 < Free Open Study > 

Close All Saved Windows in the IDE

The following procedure will close all open windows in the IDE that currently have not been changed since they were saved. It uses the Documents collection to access the open windows. It uses the Saved property of the Document.Items() object to determine if a document is saved or "dirty".

    Public Sub CloseAllSavedWindows()      ' Close all saved documents.      Dim i As Integer      With oVB           On Error Resume Next           For i = .Documents.Count To 1 Step -1             If .Documents.Item(i).Saved Then              .Documents.Item(i).Close(vsSaveChanges                 .vsSaveChangesPrompt)             End If           Next i      End With    End Sub

 < Free Open Study > 

Writing Add-Ins for Visual Studio  .NET
Writing Add-Ins for Visual Studio .NET
ISBN: 1590590260
EAN: 2147483647
Year: 2002
Pages: 172
Authors: Les Smith © 2008-2017.
If you may any questions please contact us: