Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Close the Immediate Window - VBA

Tags:

excel

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) ??

like image 850
Gary's Student Avatar asked Mar 05 '26 08:03

Gary's Student


1 Answers

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?

like image 157
Mathieu Guindon Avatar answered Mar 07 '26 01:03

Mathieu Guindon