Hello,
Debug.Print "TEXT" send/print "TEXT" to VBE immediate windowORfor x=1 to 100 'send/print 1 2 3 4 5 6 ....... 100 to VBE immediate windowdebug.print xnext
How can clear immediate window, using VBA code?Greetings!
why?watch, debug, local, immediate, command, output window are tools for turn easy development
Now It's hard for me to explain, but I need it
ok, but ...Sub test() Dim obj As Object Set obj = Application.VBE For I = 1 To obj.Windows.Count If obj.Windows.Item(I).Caption = "Immediate" Then Debug.Print (obj.Windows.Item(I).Caption) obj.Windows.Item(I).SetFocus SendKeys "^{Home}", True SendKeys "^+{End}", True SendKeys "{Del}", True End If Next IEnd Sub
Hello,I thank for Your answer!Below is my code to empty immediate window
Sub immediate_window_BhBp_clear()'CLEAR IMMEDIATE WINDOWSet WshShell = CreateObject("WScript.Shell")WshShell.SendKeys "^g^a{DEL}"End Sub
How to run code above.Place this code in any Macros moduleOpen VBEPress Ctrl-g 'to open immediate window
print "immediate" in immediate windowPress Ctrl-space 'drop down list with macros beginning with "immediate" appearsSelect necessary macro using mouse or arrows - immediate_window_BhBp_clearPress key EnterI see, that You use SendKeys "{Del}", TrueI don't understand why SendKeys "{Del}", True return error Permission deniedI am forced to use workaround code usingSet WshShell = CreateObject("WScript.Shell")WshShell.SendKeys "^g^a{DEL}" Greetings!
Easy
Sub clearimmediatewindow() Dim i%
For i = 1 To 250 Debug.Print Next i
End Sub
I thank for Your answer!Macro below prints 1 Sub immediate_window_BhBp_put_in()'PUT IN IMMEDIATE WINDOWFor X = 1 To 200 'immediate have no more then 200 lines If Debug.Print 200 empty lines, immediate window is clearing
'You may show this when use this code:'For X = 1 To 1000Debug.Print XNext'Set WshShell = CreateObject("WScript.Shell")'WshShell.SendKeys "^g^{HOME}" 'goto first lineEnd Sub
How to run this code.Place this code in any Macros moduleOpen VBEPress Ctrl-g
print "immediate" in immediate windowPress Ctrl-space 'drop down list with macros beginning with "immediate" appearsSelect necessary macro using mouse or arrows - mmediate_window_BhBp_put_inPress key EnterGreetings!