Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB.NET
Expertise: Beginner
Apr 26, 2004

Close and Save All Except Your Current Window

When you're working on large projects, it's common to have a bunch of open windows cluttering your desktop. Closing all the windows you're not working on is tedious. To automate this task, create a new macro and paste in this code:

Sub Closeallexceptcurrent()
        Dim i As Integer
        Dim sCurrWin As String = DTE.ActiveDocument.Name

        With DTE
             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
Sivaraj Padmaraj
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap