0% found this document useful (0 votes)
39 views16 pages

Introduction To VBA: Prof. Name: Position (123) 456-7890 University Name

The document introduces Visual Basic for Applications (VBA) and the Visual Basic Editor (VBE) environment. It discusses the main VBE windows including the Project Explorer, Properties Window, and Code Window. It also explains how objects in Excel like workbooks, worksheets, and cells can be manipulated in VBA through their properties and methods. Finally, it provides an overview of the Object Browser and how it displays the properties and methods for all Excel objects.

Uploaded by

Carlo Cersso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views16 pages

Introduction To VBA: Prof. Name: Position (123) 456-7890 University Name

The document introduces Visual Basic for Applications (VBA) and the Visual Basic Editor (VBE) environment. It discusses the main VBE windows including the Project Explorer, Properties Window, and Code Window. It also explains how objects in Excel like workbooks, worksheets, and cells can be manipulated in VBA through their properties and methods. Finally, it provides an overview of the Object Browser and how it displays the properties and methods for all Excel objects.

Uploaded by

Carlo Cersso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 16

Introduction to VBA

http://www.dssbooks.com/excel/chapterFiles.html

Prof. Name: [email protected]


Position (123) 456-7890
University Name
Overview
 11.1 Introduction
 11.2 The Visual Basic Editor
 11.3 The Object Browser
 11.4 Summary

2
Introduction
 The basics of the Visual Basic Editor environment.

 The components of the Project Explorer, Properties, and Code Windows.

 The difference between a property, method, and event.

 The Object Browser.

3
The Visual Basic Editor
 Project Explorer

 Properties Window

 Code Window

 Immediate and Watch Windows

 VBE Toolbars

4
Objects
 Objects in Excel include
– Workbooks and worksheets
– Cells and ranges of cells
– Charts

 There is an object hierarchy which orders these objects


– Workbooks contain worksheets
– Worksheets contain ranges
– Ranges contain cells

 Objects are manipulated in VBA by


– Properties = value is given to describe or format the object
– Methods = arguments are used to perform an action on the object

5
Visual Basic Editor
 The Visual Basic Editor (VBE) is the environment in which you work
with VBA programming code.
– Tools > Macro > Visual Basic Editor
– VBE icon from VBE Toolbar
– ALT + F11

 Three main windows in the VBE


– Project Explorer
– Properties
– Code

 Two other windows in VBE, used for debugging


– Immediate
– Watch

6
Visual Basic Editor (cont)
 The Visual Basic Editor windows

Code
Project Window
Explorer

Properties
Window
Watch
Window

Immediate
Window

7
Project Explorer
 Lists all projects in any open workbook.

 Each workbook has a project, and each


project can have several parts
– Workbook and worksheets
– Modules
– Forms

 Use Insert > Module or Insert > User Form


to add a new module or form to the current
project; can also use icon from standard
toolbar.

8
Properties Window
 Contains detailed information about any
selected part of a project in the Project
Explorer.

 Some basic naming and formatting


properties can be modified for worksheets
and workbooks.

 Properties are very important for user


forms
– Formatting
– Position
– Picture
– Scrolling
– Behavior

9
Code Window
 Displays the VBA code for the highlighted part of a project in the Project
Explorer.

 When macros are recorded they are simultaneously created as VBA


code in the Visual Basic Editor.

 There are three types of macros or procedures


– Sub procedures
– Function procedures
– Event procedures

10
Immediate and Watch Windows
 Both of these windows are used for debugging.

 Immediate Window executes whatever is entered immediately.

 Watch Window displays values of inserted variables.

 Use the View menu option to view or hide any window.

11
The Object Browser
 Properties and Methods

 Libraries, Classes, and Members

12
Object Browser
 Provides a list of properties and methods of all Excel objects which
may be manipulated in VBA.

 There are larger categories into which various objects are grouped
– Classes = groups of related objects
– Libraries = collections of VBA and Excel object classes
– Members = properties, methods, and constants of a selected class of
objects

 View > Object Browser or icon from standard toolbar.

13
Object Browser (cont’d)
 All classes containing the searched object are shown in the top window.

 All members of a selected class are shown below.

14
Summary
 The Visual Basic Editor (VBE) is the environment in which you work with
VBA programming code.

 There are three main windows in VBE: the Code Window, the Project
Explorer, and the Properties Window.

 The Object Browser provides a list of properties and methods of all Excel
objects that may be manipulated in VBA.

 Properties are the physical descriptions of all Excel objects, and the
description of the particular property is called the value of the property.

 Methods are the actions that can be performed on the object. The
elements of a method statement are called the arguments of the method.

15
Additional Links
 (place links here)

16

You might also like