Properties and Methods

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

To work with the content and functionality exposed by an object, you use properties and methods of that object. The following Excel example uses the Value property of the Range object to set the contents of cell B3 on the Sales worksheet in the Current.xls workbook to 3:

Workbooks("Current.xls").Worksheets("Sales").Range("B3").Value = 3

The following example uses the Bold property of the Font object to apply bold formatting to cell B3 on the Sales worksheet:

Workbooks("Current.xls").Worksheets("Sales").Range("B3").Font.Bold = True

The following Word example uses the Close method of the Document object to close the file named Draft3.doc:

Documents("Draft3.doc").Close

In general, you use properties to set or read the content, which can include the text or value contained in an object, or other attributes of the object, and you use methods to work with an application's (or the Microsoft® Visual Basic® for Applications) built-in functionality to perform operations on the content. Be aware, however, that this distinction doesn't always hold true; there are a number of properties and methods in every object model that are exceptions to this rule.

See Also

Objects, Collections, and Object Models: Technology Backgrounder | Objects Exposed by an Object Model | Collections | Events | Using the Object Browser | Working with the Outlook Object Model