When you have multiple projects in your solution, you often want to locate the active document in the solution explorer. There is a great option in Visual Studio which can do it for you all the time : “View.TrackActivityInSolutionExplorer”.

 

But if you do not want (as me) to turn it on all the time, there is no specific option or shortcut. So I have created a little macro which make my life easier. It simply turn on then off the option resulting by centering the active document in the solution explorer.

 

Here is the macro ( I put the Alt-T shorcut on it) :

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Public Module Utilities
Public Sub TrackProjectItem()
DTE.ExecuteCommand("View.TrackActivityInSolutionExplorer")
DTE.ExecuteCommand("View.TrackActivityInSolutionExplorer")
End Sub
End Module


Shout it kick it on DotNetKicks.com