ActiveDocument.CustomDocum
Main Topics
Browse All TopicsI have added a custom property to word templates which specify how to calculate where the file is to be saved.
In a Delphi-7 program I need to find this CustomProperty (preferably by name).
There is a DocumentCustomProperties property of the Active Document which is an IDespatch interface, so it has no sub properties visible.
There is an Interface CustomProperties, which as far as I can see is not supported by either the ActiveDocument or the DocumentCustomProperties interface.
How can I get access to the CustomProperties of the Word document.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Well, I have to admit that in Delphi that is not as obvious as in VB.
I managed, with a Word : WordApplication; component to access the custom properties but this has not been without loosing some hairs first.
(most) strange thing is that I could not access to the
Word.ActiveDocument.Custom
oh, I forgot one line near the end.
VarBool:=False;
Word.ActiveDocument.Close(
and of course the definition of VarBool:OleVariant;
The fact that in delphi you have to put all the parameters and that for some unknown reasons they are VAR parameters, so I have to put a variable, not a constant (like VarBool, not false directly) is pretty much annoying... again, some hairs gone for this...
Epasquier thanks I will be accepting multiple solutions, as I feel any contribution should get some points, but your reply was the only one that seemed to have picked up the important point that while I could do the stuff I was referring to in VB, I needed to do it in Delphi which being strongly typed causes some issues with some COM interfaces.
This works
var
WrkOLEVar: OLEVariant;
WrkOLEVar := 'TPSmartSavePath';
CPVal := CustomPropsVI.Item[WrkOLEV
This does not
CPVal := CustomPropsVI.Item['TPSmar
As you say VAR parameters require variables to be set up.
I would like to get typed objects from CustomDocumentProperties, but cannot find a way to map from CustomDocumentproperties to either of the two interfaces below. Any ideas?
CustomProperty = interface(IDispatch)
['{B923FDE0-F08C-11D3-91B0
function Get_Name: WideString; safecall;
function Get_Value: WideString; safecall;
procedure Set_Value(const prop: WideString); safecall;
function Get_Application: WordApplication; safecall;
function Get_Creator: Integer; safecall;
function Get_Parent: IDispatch; safecall;
procedure Delete; safecall;
property Name: WideString read Get_Name;
property Value: WideString read Get_Value write Set_Value;
property Application_: WordApplication read Get_Application;
property Creator: Integer read Get_Creator;
property Parent: IDispatch read Get_Parent;
end;
CustomProperties = interface(IDispatch)
['{B923FDE1-F08C-11D3-91B0
function Get__NewEnum: IUnknown; safecall;
function Get_Count: Integer; safecall;
function Get_Application: WordApplication; safecall;
function Get_Creator: Integer; safecall;
function Get_Parent: IDispatch; safecall;
function Item(var Index: OleVariant): CustomProperty; safecall;
function Add(const Name: WideString; const Value: WideString): CustomProperty; safecall;
property _NewEnum: IUnknown read Get__NewEnum;
property Count: Integer read Get_Count;
property Application_: WordApplication read Get_Application;
property Creator: Integer read Get_Creator;
property Parent: IDispatch read Get_Parent;
end;
Business Accounts
Answer for Membership
by: GrahamSkanPosted on 2009-11-04 at 11:42:30ID: 25743071
DocumentCustomProperties is the collection of any custom properties for the document.
Individual properties can be accessed by numerical index or by name