VBA Integrated Development Environment
You can set up the IDE to support the way you work. Some people like to have all the main tool windows open all the time. Others like to just have one or two open. Note though once you have them docked like above you quickly learn not to change it as it is so hard to re-dock them the same way.
VBA Environment
Unfortunately the default environment settings are not geared towards high quality development, they are set to make it easy for beginners to get productive quickly.
These are our preferred settings for professional quality development (Tools>>Options)
The default is to have those top 2 reversed.
You always get Auto Syntax Check (line goes red), removing the tick stops the disruptive modal error message boxes from constantly popping up every time you move off a line to copy something:
If the advice were a bit more helpful it might be worthwhile, but even beginners would struggle to get any value out of the above example. And it isn't going to get better as VBA is end of lined. Advice: Turn off Auto Syntax Check.
Require Variable Declaration puts an 'Option Explicit' at the top of each new code resource you open (module, class, form etc) (note it is not retrospective, hence the need to set it ASAP). Not using option explicit is just sloppy and is sure to lead to hard to spot errors in any significant coding.
if you want to use a variable called x (you may be able to think of a more meaningful name) OE forces you to 'Dim' it first, and optionally to decide what data type it should be. If OE is missing VB will implicitly Dim the variable as a variant the first time you use it, if you later mistype the variable name VB will create another new variable, rather than warn you 'Variable not defined' which would be more useful.
Another bizarre default setting is the way the IDE does not show one of the most important toolbars as standard. Luckily you can right click in the menu area and show the Edit toolbar.
The 2 very useful commands here are the ones with blue lines, the first one comments out a line, the one with the blue arrow un-comments it.
Also of note is the option to show the MZ-Tools toolbar. This is an excellent free add-in that is vital to serious Excel VBA development. MZ Tools is available from here.
Note these settings will be reflected in other Office applications. |