Mirror

Get and set the BuiltinDocumentProperty of a Word document (Views: 100)

Problem/Question/Abstract:

How to get and set the BuiltinDocumentProperty of a Word document

Answer:

{ ... }
var
VDoc, PropName, DocName: OleVariant;
{ ... }
VDoc := Word.ActiveDocument;
{Get a built in property}
ShowMessage(VDoc.BuiltInDocumentProperties['Title'].Value);
{Get a custom property}
PropName := 'MyOpinionOfThisDocument';
VDoc.CustomDocumentProperties.Add(PropName, False, msoPropertyTypeString,
'Hey', EmptyParam);
Caption := VDoc.CustomDocumentProperties[PropName].Value;
{ ... }


<< Back to main page