Saturday, June 25, 2011

Diffrence between VB and VBA (visual basic for application)

VBA is based on Visual Basic, a programming language derived from BASIC. BASIC stands
for Beginner’s All-Purpose Symbolic Instruction Code. BASIC is designed to be user-friendly, because it employs recognizable English words (or quasi-recognizable variations on them) rather than abstruse and incomprehensible programming terms. In addition to its English-like diction, BASIC’s designers endeavored to keep its punctuation and syntax as simple and natural as possible.
Visual Basic is visual in that it offers drag-and-drop programming techniques and many graphical elements. Visual Basic for Applications consists of Visual Basic implementations that share a common core of objects and commands, but also include application-specific objects and language elements. The set of objects available in each application differs because no two applications share the same features and commands. For example, some VBA objects available in Word are not available in
Excel (and vice versa), because VBA implements features and commands that Word has but Excel does not.
However, the large set of primary commands, fundamental structure, and core programming techniques of VBA in Word and VBA in Excel are the same. So you’ll find that it’s often quite easy to translate your knowledge of VBA in Word to VBA in Excel (or indeed in any VBA-enabled application).
For example, you’d use the Save method (a method is essentially a command) to save a file in Excel VBA, Word VBA, or PowerPoint VBA. What differs is the object involved. In Excel VBA, the command would be ActiveWorkbook.Save, whereas in Word VBA, it would be ActiveDocument.Save, and in PowerPoint, it would be ActivePresentation.Save.
VBA always works with a host application (such as Access or Word). With the exception of some large-scale standalone programs that are usually best created with Visual Studio Tools for Office, a host application always needs to be open for VBA to run. This means that you can’t build standalone applications with VBA the way you can with Visual Basic .NET or VSTO. If necessary, you can hide the host application fromusers so that all they see is the interface (typically user forms) that you give to your VBA procedures. By doing this, you can create the illusion of a standalone application. Whether you need to employ this technique will depend on the type of programming you do.

No comments:

Subscribe Now: From your browser

Search:

Learn Office Excel