Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2005

Tip: Looking for answers? Try searching our database.

Create custom document property vs just change value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
KR - 24 Feb 2005 16:07 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
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


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.