Tutorial by Examples

To explicitly declare variables in VBA, use the Dim statement, followed by the variable name and type. If a variable is used without being declared, or if no type is specified, it will be assigned the type Variant. Use the Option Explicit statement on first line of a module to force all variables t...
Step 1: Open a Workbook Step 2 Option A: Press Alt + F11 This is the standard shortcut to open the VBE. Step 2 Option B: Developer Tab --> View Code First, the Developer Tab must be added to the ribbon. Go to File -> Options -> Customize Ribbon, then check the box for developer. ...
The procedure describes how to add an Object library reference, and afterwards how to declare new variables with reference to the new library class objects. The example below shows how to add the PowerPoint library to the existing VB Project. As can be seen, currently the PowerPoint Object library...
Open the Visual Basic Editor ( see Opening the Visual Basic Editor ) Click Insert --> Module to add a new Module : Copy and Paste the following code in the new module : Sub hello() MsgBox "Hello World !" End Sub To obtain : Click on the green “play” arr...
This example intend to be a gentle introduction to the Excel Object Model for beginners. Open the Visual Basic Editor (VBE) Click View --> Immediate Window to open the Immediate Window (or ctrl + G): You should see the following Immediate Window at the bottom on VBE: This wi...

Page 1 of 1