5.15. The Bottom Line

Understand the basics of VBA. VBA includes two types of procedures, used for different purposes.

Master It Name the two types of procedures used in VBA (and indeed in most computer languages), and describe the difference between them.

Work with procedures and functions. A procedure is a container for a set of programming statements that accomplish a particular job.

Master It Write a subprocedure in the Visual Basic Editor that displays a message to the user. Then execute that subprocedure.

Use the Immediate window to execute statements. When you're writing code, you often want to test a single line (a statement) to see if you have the syntax and punctuation right, or if it produces the expected result.

Master It Open the Immediate window, type in a line of code, and then execute that line.

Understand objects, properties, methods, and events. Object-oriented programming (OOP) has become the fundamental paradigm upon which large programming projects are built. Generally speaking, macros are not large, and therefore don't benefit from the clerical, security, and other benefits that OOP offers — particularly for people who write large applications as a team.

However, code libraries, such as the vast VBA set of objects and their members (not to mention the even vaster .NET libraries that tap into the power of the operating system itself) are written by great groups of people. These libraries require a way to organize their objects and functions — to categorize them and allow you to execute the methods and manage their properties and arguments. As a result, another aspect of OOP — taxonomy — becomes an important issue even when writing brief macros.

Master It Look up the Document object in the Visual Basic Editor's Help system; then look at its methods.

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

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