CitectVBA Programming Reference > Understanding CitectVBA Language Basics > OLE Services > What is a property?

What is a property?

A property is an attribute of an object or an aspect of its behavior. For example, properties of a Word document include its name, its content, and its save status, as well as whether change tracking is turned on. To change the characteristics of any referenced object, you change the values of its properties.

To set the value of a property, follow the reference to an object with a period, the property name, an equal sign, and the new property value. The following example turns on change tracking in the Word document named "MyDoc.doc."

objWordApp.Documents("MyDoc.doc").TrackRevisions = True

In this example, Documents refers to the collection of open documents, and the name "MyDoc.doc" identifies a single document in the collection. The TrackRevisions property is set for that single document.

You can also return information about an object by returning the value of one of its properties. The following example returns the name of the active Word document.

docName = objWordApp.ActiveDocument.Name

In this example, ActiveDocument refers to the document in the active window in Word. The name of that document is assigned to the variable "docName".

Note: Some properties cannot be set. The Help topic for each property indicates whether you can set that property (read-write), only read the property (read-only), or only write the property (write-only). Also the Object Browser in the Visual Basic Editor displays the read-write status at the bottom of the browser window when the property is selected.