Escolar Documentos
Profissional Documentos
Cultura Documentos
VBA Programming
Introducing VBA
Disadvantages
Jumping Right In
Recording macro vs Using Excel built-in
function (for paste special, values only)
Live view macro recording sample
CommandBar object
Window object
Workbook object
WorksheetFunction object
Workbook object
Chart object
Name object
VBProject object
Window object
Worksheet object
Worksheet object
Comment object
Hyperlink object
Name object
Outline object
PageSetup object
PivotTable object
Range object
Collections of Objects
A collection is a group of objects of the same
type And a collection is itself an object !
Few examples of commonly used collections:
Workbooks collection
Worksheets collection
Charts collection
Sheets collection
collection names are all plural: Chart>Charts
Referring to Objects
(members of a collections)
Worksheets(Sheet1) by name
Worksheets(1) by order
Object properties
Every object has properties.
Properties are attributes that describe the object,
determine how it looks, how it behaves, and even
whether it is visible.
Using VBA, you can do two things with an
objects properties:
Examine the current setting for a property
Change the propertys setting
Object methods
A method is an action you perform with an
object
Most methods also take one or more arguments.
An argument is a value that further specifies the
action to perform.
Place the arguments for a method after the
method, separated by a space. Multiple
arguments are separated by a comma.
Object events
Objects respond to various events that occur
For example, when youre working in Excel and
you activate a different workbook, an Activate
event occurs