Sub ImmediateWindowOpenClearCloseProgramatically()
If Application.VBE.MainWindow.Visible = False Then Application.SendKeys Keys:="%{F11}" ' VB Editor window Alt+F11
Application.SendKeys Keys:="^g" ' Immediate Window Ctrl+g
DoEvents: DoEvents
Debug.Print "Hello," & vbCr & vbLf & "Hopefully this will all be cleared in a few seconds"
MsgBox Prompt:="Hello, click OK , then after this procedure is finished I open the Immediate window which theoretically I should have already done"
DoEvents: DoEvents
Application.OnTime earliesttime:=Now + TimeValue("0:00:03"), procedure:="WipeMy_" ' Clear Immediate Window
Application.OnTime earliesttime:=Now + TimeValue("0:00:06"), procedure:="Trash_t" ' Close windows
End Sub
Public Sub Trash_t() ' Close Windows
On Error Resume Next ' Add the "Name" for your Excel language version
Application.VBE.Windows("Immediate").Close ' English Excel
Application.VBE.Windows("Direktbereich").Close ' German Excel
On Error GoTo 0
Let Application.VBE.MainWindow.Visible = False
End Sub
Public Sub WipeMy_() ' Clear Immediate Window
Application.SendKeys "^g ^a {DEL} " ' {HOME}"
End Sub
' https://www.excelforum.com/excel-programming-vba-macros/343845-docking-project-explorer-vertically-2.html#post4545938
' https://www.excelcampus.com/vba/vba-immediate-window-excel/
' https://social.msdn.microsoft.com/Forums/office/en-US/da87e63f-676b-4505-adeb-564257a56cfe/vba-to-clear-the-immediate-window?forum=exceldev
' https://www.excelcampus.com/vba/vba-immediate-window-excel/#comment-90911
' http://www.eileenslounge.com/viewtopic.php?f=30&t=29579#p229156
' http://dailydoseofexcel.com/archives/2004/06/09/clear-the-immediate-window/#comment-1045809
' http://www.eileenslounge.com/viewtopic.php?f=30&t=31260#p242289
Comments
0 B
|👍
/👎
0 B
|0 👍
/0 👎
0 B
|👍
/👎