0% found this document useful (0 votes)
41 views1 page

Uderstand Object PDF

The document discusses objects, methods, properties, and events in Visual Basic code. An object represents an element of an application like a worksheet or cell. A method is a procedure that acts on an object, while a property defines characteristics of an object. A collection contains multiple objects, usually of the same type, and items can be identified by number or name to manipulate individual objects or the entire collection.

Uploaded by

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

Uderstand Object PDF

The document discusses objects, methods, properties, and events in Visual Basic code. An object represents an element of an application like a worksheet or cell. A method is a procedure that acts on an object, while a property defines characteristics of an object. A collection contains multiple objects, usually of the same type, and items can be identified by number or name to manipulate individual objects or the entire collection.

Uploaded by

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

Understanding objects, methods, properties, and events

Objects and collections

An object represents an element of an application, such as a worksheet, a cell, a chart, a


form, or a report. In Visual Basic code, you must identify an object before you can apply
one of the object's methods or change the value of one of its properties.

method
A procedure that acts on an object.
property
A named attribute of an object. Properties define object characteristics such as size, color, and screen
location, or the state of an object, such as enabled or disabled.

A collection is an object that contains several other objects, usually, but not always, of the
same type. In Microsoft Excel, for example, the Workbooks object contains all the
open Workbook objects. In Visual Basic, the Forms collection contains all
the Form objects in an application.

Items in a collection can be identified by number or by name. For example, the


following procedure identifies the first open Workbook object.

procedure
A named sequence of statements executed as a unit. For example, Function, Property, and Sub are types of
procedures. A procedure name is always defined at module level. All executable code must be contained in
a procedure. Procedures can't be nested within other procedures.

VBCopy
Sub CloseFirst()
Workbooks(1).Close
End Sub

The following procedure uses a name specified as a string to identify a Form object.
VBCopy
Sub CloseForm()
Forms("MyForm.frm").Close
End Sub

You can also manipulate an entire collection of objects if the objects share
common methods. For example, the following procedure closes all open forms.

You might also like