Code window

Code window

Use the Code window to write, display, and edit Visual Basic code. You lot can open equally many Code windows as you have modules, then you lot tin easily view the code in dissimilar forms or modules, and copy and paste between them.

Y'all can open a Code window from:

  • The Projection window, past 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 carte du jour, or pressing F7.

Y'all can drag selected text to:

  • A different location in the electric current Code window.
  • Another Code window.
  • The Firsthand and Watch windows.
  • The Recycle Bin.

Window elements

Element Icon Description
Object box Displays the proper name of the selected object. Click the arrow to the correct of the list box to display a list of all objects associated with the form.
Procedures/Events box Lists all the events recognized by Visual Bones for a form or control displayed in the Object box. When you select an issue, the consequence procedure associated with that event name is displayed in the Code window.

If (General) is displayed in the Object box, the Procedure box lists any declarations and all of the general procedures that accept been created for the form. If you are editing module lawmaking, the Procedure box lists all of the general procedures in the module. In either example, the procedure y'all select in the Procedure box is displayed in the Code window.

All the procedures in a module appear in a single, scrollable list that is sorted alphabetically by name. Selecting a process by using the drop-downwardly list boxes at the top of the Code window moves the cursor to the beginning line of lawmaking in the procedure you select.

Divide bar Dragging this bar down splits the Code window into two horizontal panes, each of which scrolls separately. You can then view unlike parts of your code at the same fourth dimension. The data that appears in the Object box and Procedures/Events box applies to the code in the pane that has the focus. Dragging the bar to the top or the bottom of the window or double-clicking the bar closes a pane.
Margin Indicator bar A gray surface area on the left side of the Lawmaking window where margin indicators are displayed.
Procedure View icon Procedure View icon Displays the selected procedure. Only one procedure at a fourth dimension is displayed in the Code window.
Full Module View icon Full Module View icon Displays the entire code in the module.

Keyboard shortcuts

Use the following shortcut keys to access commands in the Lawmaking window.

Description Shortcut keys
View Code window F7
View Object Browser F2
Discover CTRL+F
Supplant CTRL+H
Find Side by side F3
Find Previous SHIFT+F3
Adjacent procedure CTRL+DOWN ARROW
Previous procedure CTRL+UP Pointer
View definition SHIFT+F2
Shift one screen down CTRL+PAGE DOWN
Shift one screen upward CTRL+Folio Upwardly
Go to last position CTRL+SHIFT+F2
Beginning of module CTRL+HOME
Terminate of module CTRL+END
Move one give-and-take to right CTRL+RIGHT ARROW
Movement one word to left CTRL+LEFT ARROW
Movement to end of line END
Move to beginning of line HOME
Disengage CTRL+Z
Delete current line CTRL+Y
Delete to terminate of word CTRL+DELETE
Indent TAB
Outdent SHIFT+TAB
Clear all breakpoints CTRL+SHIFT+F9
View shortcut bill of fare SHIFT+F10

Run across too

  • Lawmaking window editing keys
  • Code window general use keys
  • Code window bill of fare shortcut keys
  • Code window navigation keys
  • Lawmaking window and Object Browser icons
  • Split the Code window
  • Window elements

Support and feedback

Have questions or feedback virtually Office VBA or this documentation? Please see Part VBA support and feedback for guidance about the ways you tin receive back up and provide feedback.