Value Property

      Applies To

Sets or returns the value of the property returned by the Property object.

Syntax

Property Get Value () As Variant

Property Let Value (Data As Variant) As Variant

Remarks

The Value property determines the default value for the Property object. Since this returns a Variant, any type of property should be accessible. Objects should be returned as the object type, arrays as arrays. A Property object representing multiple values returns them through the IndexedValue property, and the number of values is returned by the NumIndices property. Setting the Value property works appropriately depending on the type of the value.

The Value property is always of type Variant, and it is possible that some variant values cannot be packaged into remote function calls. If the property type doesn’t marshall, then it is accessible only by in-process consumers of the object model. Moving data and pointers between two memory spaces, whether two processes or two threads in the same process, is called marshalling. Marshalling is really just the process of packing, unpacking, and translating data or pointers from one interface to another.

If the property that the Property object represents is read/write at design time, then the Value property is read/write. If the property is read-only, attempting to set the Value property causes an error. If the property is write-only, attempting to return the Value property causes an error.

If the add-in interacts with the Value property and in doing so causes a critical error, an exception is generated. If the add-in interacts with the Value property and causes a message box to be displayed, the development environment assumes the default for the message box.