Here is a macro that does this. In the IDE Class View Macro, navigate to MyMacros - EnvironmentEvents. Open (double click) EnvironmentEvents. Paste the following code inside the module:
Private Sub BuildEvents_OnBuildDone( _ ByVal Scope As EnvDTE.vsBuildScope, _ ByVal Action As EnvDTE.vsBuildAction) _ Handles BuildEvents.OnBuildDone Try Dim activeWin As Window = DTE.ActiveWindow Dim immedWin As Window = DTE.Windows.Item("{ECB7191A-597B-41F5-9843-03A4CF275DDE}") immedWin.Activate() DTE.ExecuteCommand("Edit.ClearAll") activeWin.Activate() Catch ex As Exception End Try End Sub
Here you can see how it should look: 
See my short tutorial on how to create and execute a VS macro.
Peter Macej
source share