none
How to you retrieve the "wdpropertyauthor" property of an activedocument in Word? RRS feed

  • Question

  • Here's what I've tried:

        Dim Author = wd.ActiveDocument.BuiltInDocumentProperties.wdPropertyAuthor

    But that generates an error, saying "wdpropertyauthor" isn't a "document property"

    ("wd" is an instance of Microsoft Word)


    Robert Homes



    Friday, April 24, 2015 2:10 AM

Answers

  • Hi Robert,

    Based on my understanding, the ActiveDocument.BuiltInDocumentProperties returns a DocumentProperties collection that represents all the built-in document properties for the specified document.

    We can use index to get the documentProperty we wanted. Here is an sample for your reference:

    ActiveDocument.BuiltInDocumentProperties(wdPropertyAuthor).Value
    

    You can get more detail about this property form link below:
    Document.BuiltInDocumentProperties Property (Word)

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Robert Homes Tuesday, April 28, 2015 4:37 AM
    Tuesday, April 28, 2015 2:28 AM
    Moderator
  • Fei -- your code:

    ActiveDocument.BuiltInDocumentProperties(wdPropertyAuthor).Value

    worked! Thank you.

    (I had tried dozens of different versions of that without success. The problem is that just putting "wdPropertyAuthor" inside the parens doesn't work if you are (like me) doing this in Vb.net outside of Word, rather than in VBA in Word itself. For that, you have to add a prefix, which I finally found (based on the confidence your code gave me that I was on the right track with the property inside parens and the other stuff). The prefix is "wdBuiltInProperty". So the full line as I need to use it is --

    wd.ActiveDocument.BuiltInDocumentProperties(wdBuiltInProperty.wdPropertyAuthor).value

    Thanks.


    Robert Homes


    • Marked as answer by Robert Homes Tuesday, April 28, 2015 4:37 AM
    • Edited by Robert Homes Tuesday, April 28, 2015 4:38 AM
    Tuesday, April 28, 2015 4:37 AM

All replies

  • Hi Robert,

    Based on my understanding, the ActiveDocument.BuiltInDocumentProperties returns a DocumentProperties collection that represents all the built-in document properties for the specified document.

    We can use index to get the documentProperty we wanted. Here is an sample for your reference:

    ActiveDocument.BuiltInDocumentProperties(wdPropertyAuthor).Value
    

    You can get more detail about this property form link below:
    Document.BuiltInDocumentProperties Property (Word)

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Robert Homes Tuesday, April 28, 2015 4:37 AM
    Tuesday, April 28, 2015 2:28 AM
    Moderator
  • Fei -- your code:

    ActiveDocument.BuiltInDocumentProperties(wdPropertyAuthor).Value

    worked! Thank you.

    (I had tried dozens of different versions of that without success. The problem is that just putting "wdPropertyAuthor" inside the parens doesn't work if you are (like me) doing this in Vb.net outside of Word, rather than in VBA in Word itself. For that, you have to add a prefix, which I finally found (based on the confidence your code gave me that I was on the right track with the property inside parens and the other stuff). The prefix is "wdBuiltInProperty". So the full line as I need to use it is --

    wd.ActiveDocument.BuiltInDocumentProperties(wdBuiltInProperty.wdPropertyAuthor).value

    Thanks.


    Robert Homes


    • Marked as answer by Robert Homes Tuesday, April 28, 2015 4:37 AM
    • Edited by Robert Homes Tuesday, April 28, 2015 4:38 AM
    Tuesday, April 28, 2015 4:37 AM