Conventions Used In This Book

This book uses different typefaces to differentiate between VBA code, regular English, text that you type in, and to help identify important concepts and definitions. The various typefaces and their purpose are listed below.

  • VBA code in the body of the text is shown in this typeface.

  • Text that you type in, appears on-screen, or represents text that you supply in a code statement looks like this.

  • Important terms are identified with italic text.

Lines of code that are provided as examples in the text are formatted as shown following:

This is an example of code formatting.

Throughout the book, various generic syntax examples are shown, they use the code formatting shown above, with some parts of the code in italics. The portion in italics represents a place-holder; you replace the place-holder items with values appropriate to the program statement you want to create:

expression.Open(Required, [ Optional])

In the preceding line, the terms represented by expression, Required, and Optional are place-holders. The item enclosed in square brackets represents an element that is optionally included in the syntax.

Code Listings contain complete, executable VBA procedures. A sample Code Listing is shown below:

1Sub HelloWorld()
2    MsgBox "Hello, World!"
3End Sub

Each Code Listing is followed by an analysis of the code shown. The Code Listing contains line numbers to make the analysis discussion easier by being able to refer to lines in the code listing by number. The line numbers are not part of the actual VBA code. Almost every chapter is provided with a Code Examples workbook; all of the code from a chapter's Code Listings is contained in the Code Examples workbook so that you do not have to type the code in yourself. You download the sample materials from links in the "Introduction & Resources" section of each chapter. If there is more than one resource for a chapter, download all of the materials into the same folder.

Other elements of the text are:


Note boxes contain special, additional information related to the surrounding text.


Tip boxes offer advice or teach an easier way to do something.


Caution boxes inform you of potential problems and help you steer clear of serious consequences to some actions.


Warning boxes tell you about actions and problems that can result in disastrous, irreversible consequences, such as loss of data.