Code Window
Use the Code window to write, display, and edit Visual Basic code.
This displays the code associated with the item selected in the Project Explorer window.
To display the code select the item in the Project Explorer window and either choose (View > Code) or you can alternatively use the shortcut key (F7).
Also sometimes referred to as a Module window.
You can even just double click the item in the Project Explorer window.
![]() |
You can minimise, maximise, hide and rearrange your code windows.
You can open as many Code windows as you have modules, so you can easily view the code in different forms or modules, and copy and paste between them.
You can open a Code window from:
The Project window, by selecting a form or module, and choosing the View Code button.
A UserForm window, by double-clicking a control or form, choosing Code from the View menu, or pressing F7.
Macros can also be created by typing the commands directly into a code window.
This is often faster than using the macro recorder assuming you are familiar with the corresponding object model.
Code windows can hold four different types of code
1) Subroutines - a set of instructions that performs a particular task
2) Functions - a set of instructions that performs a particular task and then returns a value or an array.
3) Properties - these are used in class modules
4) Declarations - this is used to declare variables that can be used and referenced from anywhere in the module (or project).
A single VBA module can store any number of any of the above and how these are organised is up to you.
Different Views
You can change the views by clicking on the small buttons in the lower-left corner of the code window. Full Module view is the default.
A code module will normally contain more than one procedure or function.
The IDE offers you a choice of whether to display the procedures one at a time (procedure view) or all at one (full module view).
View - Full Module
icon - Full Module View Icon - Displays the entire code in the module.
This is the default.
![]() |
horizontal lines separating the procedures and functions.
View - Procedure
This can be controlled from (Tools > Options)(Editor Tab, "Default to Full Module View")
icon - Procedure View Icon - Displays the selected procedure. Only one procedure at a time is displayed in the Code window.
![]() |
There are multiple levels of Undo and Redo so don't worry if you ever remove the wrong instruction or procedure. You can click the Undo button (Ctrl + "Z") repeatedly.
After undoing, you can press F4 to redo changes that were previously undone.
Force Intellisense
When no listbox is displayed you can press (Ctrl + Spacebar) to complete the input with the given keyword (or variable name).
If there is more than one option then the listbox automatically appears.
Once the listbox has been displayed you can select the desired input with the cursor key
The Tab key completes the selection.
With ESC you can avoid having to select from the listbox and can complete the input manually.
© 2025 Better Solutions Limited. All Rights Reserved. © 2025 Better Solutions Limited TopPrevNext