Microsoft Office Tutorials and References
In Depth Information
4.5 Errors
To exit from Break mode, choose Reset from the Run menu.
Note that the caption in the title bar of the VBA IDE indicates which mode is currently active. The
caption contains the word "[running]" when in run mode and "[break]" when in break mode.
4.5 Errors
In computer jargon, an error is referred to as a bug . In case you are interested in the origin of this
word, the story goes that when operating the first large-scale digital computer, called the Mark I,
an error was traced to a moth that had found its way into the hardware. Incidentally, the Mark I
(circa 1944) had 750,000 parts, was 51 feet long, and weighed over five tons. How about putting
that on your desktop? It also executed about one instruction every six seconds, as compared to
over 200 million instructions per second for a Pentium!
Errors can be grouped into three types based on when they occur— design time , compile time , or
run time .
4.5.1 Design-Time Errors
As the name implies, a design-time error occurs during the writing of code. Perhaps the nicest
feature of the Visual Basic Editor is that it can be instructed to watch as we type code and stop us
when we make a syntax error. This automatic syntax checking can be enabled or disabled in the
Options dialog box shown in Figure 4-3 , but I strongly suggest that you keep it enabled.
Figure 4-3. The Options dialog box
Notice also that there are other settings related to the design-time environment, such has how far
to indent code in response to the Tab key. We will discuss some of these other settings a bit later.
To illustrate automatic syntax checking, Figure 4-4 shows what happens when we deliberately
enter the syntactically incorrect statement x == 5 and then attempt to move to another line. Note
Search JabSto ::

Custom Search