How do I get / Set the Properties of an Active Word Document ?

Posted on 2008-11-20
Last Modified: 2012-06-21
My Appliacation displays an instance of Word in a custom control on a WinForm. The surrounding WinForm displays extra details about the actie document being tracked by my application. One of the extra bits of information is the Document Properties of the Active Document (currently retrieved using DSOleFile.dll). BUT, my app needs to be able to update the Document Properties while the Document is still open. I can't do this with DSOleFile.dll because of a file open lock on the Document.

I have found some examples of getting / setting the Document Properties using VB / VBA and VSTO but not C#.

I can get to the object "objWinWordControl.WordAppClass.ActiveDocument.BuiltInDocumentProperties" but I can't find a way to access the subject, comment or template properties that I need.

Does anyone have any example code of how to get / set Document Properties of an ActiveDocument open in Word ?
Question by:Voicepath
    LVL 23

    Expert Comment

    Does the following not give you what you need:
    Read/Write items:
    Read only item:
    LVL 23

    Accepted Solution


    Author Comment

    Thanks for the input irudyk,
    Using your first suggestion; BuiltinProperties("Subject") gives me an error "is a Property but is used like a method".
    The link you sent worked nicely once I'd changed all the object names and I found BindingFlags in System.Reflection. But what a palava just to get the property of an avtive document !!
    A Thousand Thanks to you irudyk.

    Author Closing Comment

    Thanks again Irudyk.
    Have a good day.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
    Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
    This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
    In a previous video Micro Tutorial here at Experts Exchange (, I explained how to get a free, one-month trial of Office …

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now