Questions? Call us at: (800) 722-6004 or (215) 496-0222

Introduction to VBA (and VBScript)

Visual Basic for Applications (VBA) is a subset of the Visual Basic Programming language for use with Microsoft Word, Excel, Access etc. While it contains a many features not supported by VBScript (another subset of VB) , the basic syntax, or construction of the language, is very similar.


A variable is a virtual container in the computer's memory that's used to hold information. In concept, it is much the same as a notepad. You can jot down information on the page of a notepad and return to that specific page later to remember what you wrote or modify the information. A computer program can store information in a variable and then access that information later by referring to the variable's name.

How Do I Create a Variable?

When you create a variable, you have to give it a name. That way, when you need to find out what's contained in the variable, you use its name to let the computer know which variable you are referring to. You have two ways to create a variable. For example, you want to create a variable called Quantity, you would enter:

Dim Quantity

'To assign a value to the variable quantity use:
Quantity = 5

Visual Basic for Applications Features Not In VBScript

Category Omitted Feature/Keyword
Array Handling Option Base 
Declaring arrays with lower bound <> 0
Collection Add, Count, Item, Remove 
Access to collections using ! character (e.g., MyCollection!Foo)
Conditional Compilation #Const 
Control Flow DoEvents 
GoSub...Return, GoTo 
On Error GoTo On...GoSub, On...GoTo 
Line numbers, Line labels
Conversion CVar, CVDate Str, Val
Data Types All intrinsic data types except Variant Type...End Type
Date/Time Date statement, Time statement
DDE LinkExecute, LinkPoke, LinkRequest, LinkSend
Debugging Debug.Print 
End, Stop
Declaration Declare (for declaring DLLs) 
Error Handling Erl 
Resume, Resume Next
File Input/Output All traditional Basic file I/O
Financial All financial functions
Object Manipulation TypeOf
Objects Clipboard 
Operators Like
Options Deftype 
Option Base 
Option Compare 
Option Private Module
Select Case Expressions containing Is keyword or any comparison operators Expressions containing a range of values using the To keyword.
Strings Fixed-length strings 
LSet, RSet 
Mid Statement 
Using Objects Collection access using !

Categories: Programmer Guides

Last Updated: 2013.08.30

Need more help?

Don't hesitate to call or email us with your questions

Our office is open 9AM - 5PM Monday Through Friday (E.S.T.)

Technical Support: 215-496-0202

Toll-Free: 1 (800) 722-6004
Skype: taltech1 (Voice only)