Microsoft Office Tutorials and References
In Depth Information
Delving in to VBA
BASIC gained quite a bit of respectability in 1991 when Microsoft released Visual Basic for
Windows. This product made it easy for the masses to develop stand-alone applications for
Windows. Visual Basic has very little in common with early versions of BASIC, but Visual Basic is
the foundation on which VBA was built.
Delving in to VBA
Excel 5 was the first application on the market to feature Visual Basic for Applications (VBA).
VBA is best thought of as Microsoft’s common application scripting language, and it’s included
with most Office 2010 applications and even in applications from other vendors. Therefore, if you
master VBA by using Excel, you’ll be able to jump right in and write macros for other Microsoft
(and some non-Microsoft) products. Even better, you’ll be able to create complete solutions that
use features across various applications.
Object models
The secret to using VBA with other applications lies in understanding the object model for each
application. VBA, after all, simply manipulates objects, and each product (Excel, Word, Access,
PowerPoint, and so on) has its own unique object model. You can program an application by
using the objects that the application exposes.
Excel’s object model, for example, exposes several very powerful data analysis objects, such as
worksheets, charts, pivot tables, and numerous mathematical, financial, engineering, and general
business functions. With VBA, you can work with these objects and develop automated
procedures. While you work with VBA in Excel, you gradually build an understanding of the object
model. Warning: The object model will be very confusing at first. Eventually, however, the pieces
come together — and all of a sudden, you realize that you’ve mastered it!
VBA versus XLM
Before version 5, Excel used a powerful (but very cryptic) macro language called XLM. Later
versions of Excel (including Excel 2010) still execute XLM macros, but the capability to record
macros in XLM was removed beginning with Excel 97. As a developer, you should be aware of XLM
(in case you ever encounter macros written in that system), but you should use VBA for your
development work.
Don’t confuse the XLM macro language with eXtensible Markup Language (XML).
Although these terms share the same letters, they have nothing in common. XML is a
storage format for structured data. The Office 2010 applications use XML as their
default file format.
 
Search JabSto ::




Custom Search