Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 11: Introduction to VBA Spreadsheet-Based Decision Support Systems Prof. Name Position (123) 456-7890 University Name.

Similar presentations


Presentation on theme: "Chapter 11: Introduction to VBA Spreadsheet-Based Decision Support Systems Prof. Name Position (123) 456-7890 University Name."— Presentation transcript:

1 Chapter 11: Introduction to VBA Spreadsheet-Based Decision Support Systems Prof. Name name@email.com Position (123) 456-7890 University Name

2 2 Overview  11.1 Introduction  11.2 The Visual Basic Editor  11.3 The Object Browser  11.4 Summary

3 3 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.

4 4 The Visual Basic Editor  Project Explorer  Properties Window  Code Window  Immediate and Watch Windows  VBE Toolbars

5 5 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

6 6 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

7 7 Visual Basic Editor (cont)  The Visual Basic Editor windows Project Explorer Properties Window Code Window Watch Window Immediate Window

8 8 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.

9 9 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

10 10 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

11 11 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.

12 12 The Object Browser  Properties and Methods  Libraries, Classes, and Members

13 13 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.

14 14 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.

15 15 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.

16 16 Additional Links  (place links here)


Download ppt "Chapter 11: Introduction to VBA Spreadsheet-Based Decision Support Systems Prof. Name Position (123) 456-7890 University Name."

Similar presentations


Ads by Google