none
Word VBA Insert Document Property Object

    Question

  • trying to find code for inserting one of the activedocument.builtindocumentproperties into the body of the document.  Found several ways to place the value (text) of the property but not the property object itself (manually; Insert --> Quick Parts --> Properties --> [property])


    CAD Manager
    Wednesday, June 08, 2011 8:51 PM

All replies

  • If you record a macro of you doing this manually, what do you get and does it work for you?

    Rod Gill

    The one and only Project VBA Book Rod Gill Project Management
    Wednesday, June 08, 2011 9:54 PM
  • I tried that first.  Macro doesn't record any of the Insert... actions
    CAD Manager
    Wednesday, June 08, 2011 10:10 PM
  • to be more clear of what I'm trying to accomplish.  I have hundreds of documents with a title accross the top (not in the header).  The title is just dumb text.  I'm going to replace the text with the document's 'Title' property 'container' so the face of the document display's the property's value whenever it changes.  The value of the property Title (along with other properties) are going to be managed by a database.  I may need to set up each document manually.
    CAD Manager
    Wednesday, June 08, 2011 11:16 PM
  • Using:

    ActiveDocument.Fields.Add Selection.Range, wdFieldEmpty, "DocProperty Title"

    will add a { DOCPROPERTY Title  \* MERGEFORMAT } field at the location of the cursor.


    Hope this helps.

    Doug Robbins - Word MVP,
    dkr[atsymbol]mvps[dot]org
    Posted via the Community Bridge

    "CAD Manager" wrote in message news:feea11d9-4c3a-46b2-8dcc-0c949dcfc680@communitybridge.codeplex.com...

    to be more clear of what I'm trying to accomplish.  I have hundreds of documents with a title accross the top (not in the header).  The title is just dumb text.  I'm going to replace the text with the document's 'Title' property 'container' so the face of the document display's the property's value whenever it changes.  The value of the property Title (along with other properties) are going to be managed by a database.  I may need to set up each document manually.


    CAD Manager


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    Wednesday, June 08, 2011 11:33 PM
  • Thanks Doug,

    This creates a field linked to Title property, doesn't actually insert the property container of the document title (wdPropertyTitle) but still may accomplish what I need.  Need to test its behavior with the databse.

    thanks again,

    CAD Manager


    CAD Manager
    Thursday, June 09, 2011 2:05 PM
  • It's the same thing.


    Hope this helps.

    Doug Robbins - Word MVP,
    dkr[atsymbol]mvps[dot]org
    Posted via the Community Bridge

    "CAD Manager" wrote in message news:1c002855-08a2-4fb6-a0fe-80504a937f47@communitybridge.codeplex.com...

    Thanks Doug,

    This creates a field linked to Title property, doesn't actually insert the property container of the document title (wdPropertyTitle) but still may accomplish what I need.  Need to test its behavior with the databse.

    thanks again,

    CAD Manager


    CAD Manager


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    Thursday, June 09, 2011 10:09 PM