Sub SendKeyActionToImmediateWindow() Application.VBE.Windows.Item("Immediate").SetFocus Application.SendKeys "^a" Application.SendKeys "{Del}"End Sub