Add Method (DocumentProperties Collection)
Applies To
DocumentProperties collection object.
Description
Creates a new custom document property. You can use this method only with the collection of custom document properties.
Syntax
expression.Add(Name, LinkToContent, Type, Value, LinkSource)
expression Required. The custom DocumentProperties object.
Name Required String. The name of the property.
LinkToContent Required Boolean. Specifies whether the property is linked to the contents of the container document. If this argument is True, the LinkSource argument is required; if it's False, the value argument is required.
Type Required Long. The data type of the property. Can be one of the following MsoDocProperties constants: msoPropertyTypeBoolean, msoPropertyTypeDate, msoPropertyTypeFloat, msoPropertyTypeNumber, or msoPropertyTypeString.
Value Optional Variant. The value of the property if it's not linked to the contents of the container document. The value is converted to match the data type specified by the type argument, if possible; otherwise, an error occurs. If LinkToContent is True, the Value argument is ignored and the new document property has a default value until linked property values are updated by the container application (usually when the document is saved).
LinkSource Optional Boolean. Ignored if LinkToContent is False. The source of the linked property. The container application determines what types of source linking you can use.
See Also
DocumentProperties collection object.
Example
This example adds a new custom document property and names it "Complete." You must pass the custom DocumentProperties collection to the procedure.
Sub AddCustomProperty(dp As DocumentProperties)
dp.Add name:="Complete", linkToContent:=False, _
type:=msoPropertyTypeBoolean, value:=False
End Sub