Private Declare Function GetWindow _ Lib "user32" ( _ ByVal hWnd As Long, _ ByVal wCmd As Long) As Long Private Declare Function FindWindow _ Lib "user32" Alias "FindWindowA" ( _ ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Declare Function FindWindowEx _ Lib "user32" Alias "FindWindowExA" _ (ByVal hWnd1 As Long, ByVal hWnd2 As Long, _ ByVal lpsz1 As String, _ ByVal lpsz2 As String) As Long Private Declare Function GetKeyboardState _ Lib "user32" (pbKeyState As Byte) As Long Private Declare Function SetKeyboardState _ Lib "user32" (lppbKeyState As Byte) As Long Private Declare Function PostMessage _ Lib "user32" Alias "PostMessageA" ( _ ByVal hWnd As Long, ByVal wMsg As Long, _ ByVal wParam As Long, ByVal lParam As Long _ ) As Long Private Const WM_KEYDOWN As Long = &H100 Private Const KEYSTATE_KEYDOWN As Long = &H80 Private savState(0 To 255) As Byte Sub ClearImmediateWindow() 'Adapted by keepITcool 'Original from Jamie Collins fka "OneDayWhen" 'http://www.dicks-blog.com/excel/2004/06/clear_the_immed.html Dim hPane As Long Dim tmpState(0 To 255) As Byte hPane = GetImmHandle If hPane = 0 Then MsgBox "Immediate Window not found." If hPane