Make a Backup Copy of the Current Window

 < Free Open Study > 



Close and Save All but the Active Document

Sometimes it would be nice just to clear the desktop by closing all windows but the active window. The following procedure will do that for you. It uses the Documents collection and compares the names of the documents to the name of the current document before determining whether or not to close the window.

    Public Sub CloseAllButCurrentWindow()      Dim i As Integer      Dim sCurrWin As String = oVB.ActiveDocument.Name      Debug.WriteLine(sCurrWin)      With oVB          On Error Resume Next          For i = .Documents.Count To 1 Step -1              If .Documents.Item(i).Name <> sCurrWin Then                 If Not .Documents.Item(i).Saved Then                        .Documents.Item(i).Close(vsSaveChanges                           .vsSaveChangesYes)                 Else                        .Documents.Item(i).Close(vsSaveChanges                           .vsSaveChangesNo)                 End If              End If          Next      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

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net