Table of contents
TOC
Collapse the table of content
Expand the table of content

Code Window

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Code window

Use the Code window to write, display, and edit Visual Basic code. You can open as many Code windows as you have modules, so you can easily view the code in different forms ormodules, 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 ViewCode button.

  • A UserForm window, by double-clicking acontrol or form, choosing Code from the View menu, or pressing F7.

You can drag selected text to:

  • A different location in the current Code window.

  • Another Code window.

  • The Immediate and Watch windows.

  • The RecycleBin.

Window Elements

Object Box

Displays the name of the selected object. Click the arrow to the right 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 Basic for a form or control displayed in the Object box. When you select an event, the event 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 have been created for the form. If you are editing module code, the Procedure box lists all of the general procedures in the module. In either case, the procedure you 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 procedure using the drop down list boxes at the top of the Code window moves the cursor to the first line of code in the procedure you select.

Split Bar

Dragging this bar down, splits the Code window into two horizontal panes, each of which scrolls separately. You can then view different parts of your code at the same time. The information that appears in the Object box and Procedures/Events box applies to the code in the pane that has thefocus. 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 area on the left side of the Code window wheremargin indicators are displayed.

Code windowProcedure View Icon

Displays the selected procedure. Only one procedure at a time is displayed in the Code window.

Code windowFull Module View Icon

Displays the entire code in the module.

© 2017 Microsoft