About 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 2007 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 forth) 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: It will be very confusing at first. Eventually, however, the pieces come together - and all of a sudden, you realize that you've mastered it!

image from book
Is VBA Becoming Obsolete?

For the past few years , I've heard rumors that Microsoft is going to remove VBA from the Office applications and replace it with .NET. My understanding is that these rumors are completely unfounded. Sure, Microsoft has developed another way to automate Office applications, but VBA will be around for quite a while - at least in Excel for Windows. As I write this, Microsoft announced that VBA would no longer be part of Excel for Macintosh.

Why will VBA survive? Because literally millions of VBA-based solutions are in use and VBA is much easier to learn and use than the alternative.

image from book
 

VBA versus XLM

Before version 5, Excel used a powerful (but very cryptic) macro language called XLM. Later versions of Excel (including Excel 2007) 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.

Note  

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 2007 applications use XML as their default file format.




Excel 2007 Power Programming with VBA
Excel 2007 Power Programming with VBA (Mr. Spreadsheets Bookshelf)
ISBN: 0470044012
EAN: 2147483647
Year: 2007
Pages: 319

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net