Clear immediate window
Sub ImmediateWindowClear() Application.VBE.Windows.Item("Immediate").SetFocus Application.SendKeys "^a" Application.SendKeys "{del}" End Sub