#1
|
|||
|
|||
How to create a list of authors
What's the best way to gather a list of all authors in a document (e.g., just like Show Markup > View > Specific People)? Is there a collection of authors that I'm simply not finding? Before writing this question, I was going to put the first author name into a comma-delimited string, find the next author, see if it's in the string and add to it if not, etc., then put the authors into an array, but this seems clunky.
Also, no need to provide code - I'd actually like to write it, but I don't want to stumble through the process, only to discover later that I came up with something convoluted and complex simply because I was unaware of a more elegant method. What follows isn't really anything, just a start, before I thought to ask here: Code:
Sub GetAllAuthors() Dim MyRevision As Revision Dim MyComment As Comment For Each MyRevision In ActiveDocument.Revisions Debug.Print MyRevision.Author Next For Each MyComment In ActiveDocument.Comments Debug.Print MyComment.Author Next End Sub |
#2
|
||||
|
||||
As far as I know, Word doesn't record the names of everyone who edited the document but it does track a couple of them.
Tracking who created comments or tracked revisions is one way to approach this but it would only get a percentage of those who actually edited the document and rely on those tracked changes and comments still being in the document. If you go to File>Info you can see Word stores author(s) and last modified by names. So that should be available somewhere. If people were good enough to add themselves as authors in that view you might be getting a reasonable list. But of course it isn't going to be that easy - in practice the author is the person who first saved (or saved as) the file. You could try investigating this code further - Built In Document Properties seems the best place for author and last edits. Code:
Sub DocInspect() Dim aDI As DocumentInspector, aDP As DocumentProperty For Each aDI In ActiveDocument.DocumentInspectors Debug.Print aDI.Name Next aDI On Error Resume Next For Each aDP In ActiveDocument.BuiltInDocumentProperties Debug.Print aDP.Name, aDP.Value Next aDP End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
||||
|
||||
Quite effective, really, though I can't see what would be achieved by putting them into an array - the string can already satisfy that need.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
Thank you both for the responses. I wasn't able to get a full author list via DocumentInspector, so I've just gone with looping through the revisions, then looping through the comments; I've also found a function to alphabetize the list, without an array.
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word 2013 Referencing - Citations with more than 3 authors | Cris4py | Word | 5 | 01-05-2017 04:29 AM |
Simultaneouly edit a document with other authors | jaypas | Word | 5 | 08-22-2016 09:10 PM |
Word for Independent Authors - formatting | Ray Bright | Word | 3 | 06-09-2016 03:16 PM |
Using track changes in MSWord, is it possible to have changes done by multiple authors come under th | rob1986 | Word | 1 | 02-26-2016 05:15 PM |
How do you create a list similar to an itunes list? | hatemail13 | Excel | 1 | 08-06-2010 02:21 AM |