Excel VisualBasic Script

Private Sub Workbook_Deactivate()
    ThisWorkbook.Windows(1).WindowState = xlMinimized
End Sub