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.

doc properties

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Senad Isanovic - 09 Feb 2005 08:38 GMT
Need more information about document properties in Word 2002 (XP) doc file.
(File, Properties, Custom, Add property) How do I programmatically from VBA
add these properties. How can I rename a doc properties? Can one doc
property contain more then one value? There must be some good site where I
can find a more info about this subject. Thanks a lot!
Dave Lett - 09 Feb 2005 12:01 GMT
Hi Senad,

You can add custom document properties with something like the following:

ActiveDocument.CustomDocumentProperties.Add _
   Name:="YourName", LinkToContent:=False, Value:="Value", _
   Type:=msoPropertyTypeString

For more reading, you can check out "How to use a single VBA procedure to
read or write both custom and built-in Document Properties" at
http://word.mvps.org/faqs/macrosvba/MixedDocProps.htm

As for having multiple values per property: in theory, I think you can if
the value type is text and THEN you parse that text as an array, but I
haven't tested this.
Ummm just tested it, and it works (there might be maximum length limits for
these values):

Dim sValues
ActiveDocument.CustomDocumentProperties("YourName").delete

ActiveDocument.CustomDocumentProperties.Add _
   Name:="YourName", LinkToContent:=False,
Value:="Value1,Value2,Value3,Value4", _
   Type:=msoPropertyTypeString
sValues = Split(ActiveDocument.CustomDocumentProperties("YourName").Value,
",")
Debug.Print ActiveDocument.CustomDocumentProperties("YourName").Value
For iCount = 0 To UBound(sValues)
   Debug.Print sValues(iCount)
Next iCount

HTH,

Dave

> Need more information about document properties in Word 2002 (XP) doc file.
> (File, Properties, Custom, Add property) How do I programmatically from VBA
> add these properties. How can I rename a doc properties? Can one doc
> property contain more then one value? There must be some good site where I
> can find a more info about this subject. Thanks a lot!
 
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.