Microsoft Office Tutorials and References
In Depth Information
Customizing the VBE Environment
Using the Editor tab
Figure 7-7 shows the options that you access by clicking the Editor tab of the Options dialog box.
Figure 7-7: The Editor tab of the Options dialog box.
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 you roughly what the
problem is. If you don’t choose this setting, 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.
I keep this setting turned off because I find the dialog boxes annoying, and I can usually figure
out what’s wrong with an instruction. But if you’re new to VBA, you might find the Auto Syntax
Check assistance helpful.
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 that you insert:
If this statement appears in your module, you must explicitly define each variable that you use.
Variable declaration is an excellent habit to get into, although it does require additional effort on
your part. If you don’t declare your variables, they will all be of the Variant data type, which is
flexible but not efficient in terms of storage or speed. I discuss variable declaration in more depth
in Chapter 8.