Results 1 to 7 of 7
  1. #1
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Builtin Document Properties (VBA/Word/2000)

    With the userform I have created - I'd like to pass certain values to the built-in document properties. Mainly, author, title, comments and keywords. However, I find that the built-in doc properties are read-only. Is there another way to attack this?

    Thanks
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Builtin Document Properties (VBA/Word/2000)

    Author and Title, at least, definitely are read/write. Is there some kind of protection on the document?

  3. #3
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Builtin Document Properties (VBA/Word/2000)

    Hmmm, I assumed they are read only after looking at the help file. Perhaps I misinterpreted. The document is not protected.
    How would you place a value in the Author property (for example)?

    Thanks
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  4. #4
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Builtin Document Properties (VBA/Word/2000)

    Try something like:

    ActiveDocument.BuiltInDocumentProperties(wdPropert yAuthor) = "Yours Truly"

    Check in the helpp for BuiltInDocumentProperties for a full list of constants.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  5. #5
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Builtin Document Properties (VBA/Word/2000)

    Here is what I've been trying:
    With ActiveDocument.BuiltInDocumentProperties
    .wdPropertyAuthor = AuthorName.Text - These are the names of the text
    .wdPropertyTitle = TopicTitle.Text boxes on my form
    .wdPropertyComments = TopicDescription.Text
    .wdPropertyKeywords = ProdTitle.Text
    End With

    And here is the error message I'm getting.

    Suggestions?
    Attached Images Attached Images
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  6. #6
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Builtin Document Properties (VBA/Word/2000)

    Catherine,

    Your code sample does not follow the "template" which Geoff provided - the "wdPropertyAuthor" for example needs to be in parentheses and directly follow "BuiltInDocumentProperties" i.e.:

    ActiveDocument.BuiltInDocumentProperties(wdPropert yAuthor) = AuthorName.Text ' etc.

    Also, this code is only going to work if it is located in the userform's code module (not in a regular code module), and it needs to be in an event procedure such as the Click event for a command button.

    Gary

  7. #7
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Builtin Document Properties (VBA/Word/2000)

    Hey - what do you know - I followed directions and it worked!

    Thanks for expanding on Geoff's answer.
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •