+ Reply to Thread
Results 1 to 5 of 5

Use vba to set a unique word document tag or property

  1. #1
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    157

    Use vba to set a unique word document tag or property

    Hi all.

    I'm looking for a way to stored a unique ID string as a word document property. This will allow me to validate that I am applying processing to the correct document version, by check that the properties match. I must not use the file name, or content in the document itself.

    I have accomplished this previously in powerpoint with the this code.

    Please Login or Register  to view this content.
    But I don't see a 'tags' property in Word.
    How would you suggest that I handle it?

    Many thanks
    If my solution helped, please consider adding Rep

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2003,2007,2010
    Posts
    33,811

    Re: Use vba to set a unique word document tag or property

    Not my field of expertise but maybe this: https://docs.microsoft.com/en-us/off...stomproperties
    Trevor Shuttleworth - Excel Aid

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,582

    Re: Use vba to set a unique word document tag or property

    You could use either a document variable or a custom document property.

    Document variables can only be created by code and are not accessible via the GUI. The only way a user can access their content (in a read-only form) without VBA is by inserting a DOCVARIABLE field into the document - and supplying the variable's name as a parameter in the DOCVARIABLE field.

    Custom document properties can be created by code or via File|Info>Properties>Advanced Properties>Custom. As such, custom document properties are accessible via the GUI. Users can can also access their content (in a read-only form) without VBA by inserting a DOCPROPERTY field into the document - and supplying the property's name as a parameter in the DOCPROPERTY field.

    For more on Document Variables, see: https://docs.microsoft.com/en-us/off...ment.variables
    For more on Custom Document Properties, see: https://docs.microsoft.com/en-us/off...mentproperties
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  4. #4
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    157

    Re: Use vba to set a unique word document tag or property

    Sorry Guys. I though I had replied to this a long time ago. I guess my replies didn't save.

    My thanks to both macropod and TMS. Very helpful answers.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2003,2007,2010
    Posts
    33,811

    Re: Use vba to set a unique word document tag or property

    You're welcome. Thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Populating DocProperty fields in second Word Document from current document
    By AndyE in forum Word Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2018, 06:09 PM
  2. [SOLVED] How to email word document as an attachment with filename taken from text in document
    By laxminarayana in forum Word Programming / VBA / Macros
    Replies: 7
    Last Post: 03-08-2018, 04:46 PM
  3. Replies: 2
    Last Post: 04-19-2013, 07:02 AM
  4. Add text to Existing Word Document if it Doesn't exist create Word Document
    By unstable81 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-10-2013, 12:15 AM
  5. Inserting multiple images from a unique URL to a word document via VBA
    By simon1985 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-28-2012, 04:19 AM
  6. Replies: 0
    Last Post: 06-07-2012, 02:21 PM
  7. move to a unique point in Word document from excel
    By pooley343 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2011, 12:02 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1