简体   繁体   中英

Close the Immediate Window - VBA

With the VBA window active, I can open the Immediate Window (really a pane) in two ways:

  • with the mouse - on the Menu Bar - View > Immediate Window
  • with the keyboard - touch Ctrl + g

I can close the Immediate Window with the mouse by clicking the red "x" at the Window's upper right-hand corner.

How can I close the Immediate Window (only the bottom pane) using only the keyboard (without the mouse) ??

You could write a macro for this :)

Have this code in a standard module (requires programmatic access to the VBIDE API):

Public Sub CloseImmediatePane()
    Application.VBE.Windows("Immediate").Close
End Sub

Programmatically closing the immediate pane from the immediate pane will only make it flicker (close and come back), so you can't run this macro from the immediate pane... but you can place your cursor inside the procedure and hit F5 , and it works, docked or not!

Funky creative ideas are allowed, right?

Since it's really a window (not longer a command) you can use Alt+F4 (close active instance) like any other application (as long as its the active window)
UPDATE:
You may try Ctrl+F4 -close active window of the instance- (if it's not docked).
If it's docked, it belong to the instance of vba itself, so, I'm not quite sure how would you call the element to take it off from the dock and then close it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM