How This Book Is Structured

This book is divided into three parts. The first part of the book, Part II, The Basics, is an introduction to the main features and concepts of Visual Basic programming. Even seasoned VB professionals should find items of interest here. If you're new to VB, this part of the book is essential reading. It's divided into the following chapters:


Chapter 1

In this chapter, you'll find information on what the VBA language is and how it fits in to the family of VB products. There's also a short discussion of the history of VBA.


Chapter 2

This chapter details how you create the basic program structures in VB and VBA; how you implement procedures, functions, and properties; and how you start and stop VB and VBA programs.


Chapter 3

This chapter looks at all the VBA data types and how to use them. There is also an in-depth look at the variant, a data type unique to the VBA language.


Chapter 4

The introduction of the class module in Version 4 was probably the single most important innovation in VB since the introduction of VB itself; certainly, it has directly contributed to the success VB is now enjoying in the corporate world. In this chapter, you'll find out how to create and use class modules within VB and VBA applications.


Chapter 5

Automation—the process by which a client accesses the functionality of a server application and drives it remotely—is one of the more powerful technologies supported by VB. This chapter describes how OLE automation is handled using VBA, detailing how to create and manipulate instances of ActiveX-enabled applications.


Chapter 6

On the assumption that we all strive to create robust applications, this chapter shows how to include error handling in your VB or VBA application and how error handling is different when you're creating an ActiveX application.

The second part of the book, Part III, The Reference, consists of one large chapter, Chapter 7, which thoroughly details all the functions, statements, and object models that make up the VBA language. The emphasis here is on the language elements found in VB4, 5, and 6. Also included (but with a lesser emphasis) for backward compatibility and completeness are the language elements still present in VB but that predate VB4; where these have been superseded by later additions to the language, this is noted.

The third and final section, Part IV consists of the following appendixes:


Appendix A

A listing of all VBA functions, statements and major keywords by category.


Appendix B

The constants built into the VBA language and available at all times.


Appendix C

A list of the operators supported by VB, along with a slightly more detailed treatment of Boolean and bitwise operators.


Appendix D

A summary of the new language features and object models included in the latest version of Visual Basic.

The Format of the Language Reference

The following template has been used for all functions and statements that appear in Chapter 7:


Syntax

This section uses standard conventions (detailed in the following section) to give a synopsis of the syntax used for the language item. It also lists parameters and replaceable items, indicates whether they're optional or not, lists their data types, and provides a brief description.


Return Value

Where applicable, this section provides a brief description of the value or data type returned by the function or property.


Description

A short description of what the language element does, and when and why it should be used.


Rules at a Glance

This section describes the main points of how to use the function. The dos and don'ts are presented in the form of a bulleted list to enable you to quickly scan through the list of rules. In the vast majority of cases, this section goes well beyond the basic details found in the VB documentation.


Example

It's not uncommon for documentation to excel at providing bad examples. How often do we encounter code fragments like the following:

' Illustrate conversion from Integer to Long!
Dim iVar1 As Integer 
Dim lVar2 as Long
iVar1 = 3
lVar2 = CLng(iVar1)
Msgbox "The value of lVar2 is: " & lVar2

So you won't find the gratuitous use of examples in this book. I see little point in including a one- or two-line code snippet that basically reiterates the syntax section. Therefore, I've only included examples that enhance the understanding of the use of a language element or demonstrate a poorly documented feature of a language element.


Programming Tips and Gotchas

This is the most valuable section of Chapter 7, gained from years of experience using the VBA language in many different circumstances. The information included here will save you countless hours of head scratching and experimentation. Mostly, this is the stuff Microsoft doesn't tell you!


See Also

A simple cross-reference list of related or complimentary functions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.96.188