OnWindow Property Example
This example causes the WindowActivate procedure to be run whenever window one is activated.
ThisWorkbook.Windows(1).OnWindow = "WindowActivate"