Читать книгу Excel VBA Programming For Dummies - Dick Kusleika - Страница 63

Using the Editor tab

Оглавление

Figure 3-5 shows the options you can access by clicking the Editor tab of the Options dialog box. Use the following options in the Editor tab to control how certain things work in the VBE.

 Auto Syntax Check option: The Auto Syntax Check setting determines whether the VBE pops up a dialog box if it discovers a syntax error while you’re entering your VBA code. The dialog box tells roughly what the problem is. If you don’t choose this setting, the VBE flags syntax errors by displaying them in a different color from the rest of the code, and you don’t have to deal with any dialog boxes popping up on your screen.FIGURE 3-5: The Editor tab of the Options dialog box.

 Require Variable Declaration option: If the Require Variable Declaration option is set, VBE inserts the following statement at the beginning of each new VBA module you insert: Option ExplicitChanging this setting affects only new modules, not existing modules. If this statement appears in your module, you must explicitly define each variable you use. Chapter 7 goes into the details why you should develop this habit.

 Auto List Members option: If the Auto List Members option is set, the VBE provides some help when you’re entering your VBA code. It displays a list that would logically complete the statement you’re typing. This bit of magic is sometimes called IntelliSense. It helps you write code more quickly and accurately, making it one of the best features of the VBE. Figure 3-6 shows an example (which will make lots more sense when you start writing VBA code).FIGURE 3-6: An example of Auto List Members.

 Auto Quick Info option: If the Auto Quick Info option is set, the VBE displays information about functions and their arguments as you type, which can be very helpful. Figure 3-7 shows this feature in action, telling you about the arguments for the MsgBox function.FIGURE 3-7: Auto Quick Info offers help about the MsgBox function.

 Auto Data Tips option: If the Auto Data Tips option is set, the VBE displays the value of the variable over which your cursor is placed when you’re debugging code. When you enter the wonderful world of debugging, as described in Chapter 13, you’ll appreciate this option.

 Auto Indent setting: The Auto Indent setting determines whether the VBE automatically indents each new line of code the same as the previous line. Use the Tab key to indent your code, not the spacebar. Also, you can press Shift+Tab to “unindent” a line of code. If you want to indent more than just one line, select all the lines you want to indent. Then press the Tab key. The VBE’s Edit toolbar (which is hidden by default) contains two useful buttons: Indent and Outdent. These buttons let you quickly indent or “unindent” a block of code. Select the code and click one of these buttons to change the block’s indenting.

 Tab Width: Determines how wide your tab characters are in the equivalent number of spaces.

 Drag-and-Drop Text Editing option: The Drag-and-Drop Text Editing option, when enabled, lets you move or copy and paste text by dragging and dropping with your mouse.

 Default to Full Module View option: The Default to Full Module View option sets the default state for new modules. (It doesn’t affect existing modules.) If this option is set, procedures in the code pane appear as a single scrollable list. If this option is turned off, you can see only one procedure at a time.

 Procedure Separator option: When the Procedure Separator option is turned on, separator bars appear between procedures in a code pane.

Excel VBA Programming For Dummies

Подняться наверх