I need to be able to change the value of a custom document property if it
exists, and if it doesn't exist, create the CDP and set the value at the
same time.
The following creates a CDP, but crashes when I try to update the CDP. What
is the easiest (fewest lines of code) method to determine whether the CDP
exists, create it if it doesn't, then set the value (and if it does exist,
just set the value)?
Thanks,
Keith
ActiveDocument.CustomDocumentProperties.Add _
Name:="YourName", LinkToContent:=False, Value:="TestValue2", _
Type:=msoPropertyTypeString

Signature
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.
Jonathan West - 24 Feb 2005 16:11 GMT
>I need to be able to change the value of a custom document property if it
> exists, and if it doesn't exist, create the CDP and set the value at the
[quoted text clipped - 12 lines]
> Name:="YourName", LinkToContent:=False, Value:="TestValue2", _
> Type:=msoPropertyTypeString
Hi KR
Take a look here
How to use a single VBA procedure to read or write both custom and built-in
Document Properties
http://www.word.mvps.org/FAQs/MacrosVBA/MixedDocProps.htm

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup