Basically Programming Apps Visually

FRAMINGHAM (07/03/2000) - All right! Gearhead just received a killer question:

"What exactly is VBA?"

VBA is well-known and yet poorly understood. You most likely know VBA is a Microsoft creation and the language is part of many applications from Microsoft Corp. and other vendors, but you probably haven't used it.

VBA stands for Visual Basic for Applications and, as its name suggests, it is an embedded language for automating applications. VBA takes the place of application macros, which are simply recordings of action sequences that are replayed on command.

Macros are fine, but when you need to have conditional actions that behave differently depending on context, programmability is crucial. For example, a simple macro can't determine what to do when you're replacing a string of characters in a document where a block of characters is already selected.

Wouldn't it be nice to have a search-and-replace function smart enough to ask you whether to act on just the block or the entire document?

Another use for VBA is to change an application's interface. This might be as simple as adding another item under a menu or as complex as re-engineering the user interface. Without a rich, complex and intimately integrated programming language like VBA, these things can't be done.

VBA is arguably one step above competing languages simply because it is from Microsoft and is common throughout many Microsoft applications, including the entire Office 2000 suite. This means that it is straightforward to create solutions within Office applications to seamlessly pass data from one application to another.

Even products that compete with Microsoft applications have in many cases adopted VBA. For example, Corel Corp. lets you program Corel WordPerfect Office 2000 in VBA.

Let's look at VBA technically. VBA is an embedded language - there's no such thing as a stand-alone VBA application (although you could, if you wanted to, create a "harness application" that would do nothing but provide an infrastructure for a VBA application to run).

VBA is a collection of Dynamic Link Libraries (DLL) that you can find hidden away in \Program Files\Common Files\ Microsoft Shared\VBA. Kill off any of the DLLs or applications in this subdirectory and chances are that your local VBA support won't work.

When an application wants to run a VBA program, it calls the VBA DLL, hands it the program (this is a vast simplification but work with us, people, work with us), and the VBA DLL (that contains the VBA interpreter) executes the program and interacts with the application architecture to access menu items, manipulate documents and do whatever the calling application allows.

VBA is also event-aware, and you can create event procedures to trap things like mouse clicks and key presses and perform actions accordingly.

Better still - programming in VBA is easy because Microsoft provides a complete Integrated Development Environment that lets you create dialog boxes and other user interface objects through a simple drag-and-drop interface.

Next week, into the depths of VBA - spelunking tales to gh@gibbs.com.

Join the newsletter!

Error: Please check your email address.

More about CorelMicrosoftOn Command

Show Comments

Market Place