|
-
Apr 16th, 2008, 10:14 AM
#1
Thread Starter
New Member
[Word 2003] Macro for reporting track changes and/or comments?
hi all,
i was wondering if it is possible for a macros to produce a report of the all the track changes and/or comments in a word document, i.e. list all the changes that have occurred and all the comments that have been added and by whom? If so, does anyone have any idea what the VB code would be for this?
many thanks for your help
nick
-
Apr 16th, 2008, 11:53 AM
#2
Fanatic Member
Re: [Word 2003] Macro for reporting track changes and/or comments?
Hi there. You could look up the classes Revision and Revisions. It should be as easy as doing a for each <RevisionVariable> in Document.Revisions... Revision.Author, Revision.Range.Text.
You can also get one built by word if you File->Print and under "Print What" choose "List of Markup"
-
Apr 17th, 2008, 12:36 PM
#3
Thread Starter
New Member
Re: [Word 2003] Macro for reporting track changes and/or comments?
 Originally Posted by dmaruca
Hi there. You could look up the classes Revision and Revisions. It should be as easy as doing a for each <RevisionVariable> in Document.Revisions... Revision.Author, Revision.Range.Text.
hi dmaruca,
thanks for that, but do you know where i would write this? e.g. if i had the following as a module...
Function ReadProp(sPropName As String) As Variant
Dim bCustom As Boolean
Dim sValue As String
On Error GoTo ErrHandlerReadProp
sValue = ActiveDocument.BuiltInDocumentProperties(sPropName).Value
ReadProp = sValue
Exit Function
ContinueCustom:
bCustom = True
Custom:
sValue = ActiveDocument.CustomDocumentProperties(sPropName).Value
ReadProp = sValue
Exit Function
ErrHandlerReadProp:
Err.Clear
If Not bCustom Then
Resume ContinueCustom
Else
ReadProp = ""
Exit Function
End If
End Function
...and then had this sub to get the relevant document properties...
Sub GiveMeProperties()
Dim PropVal As String
PropVal = ReadProp("Author")
MsgBox PropVal
PropVal = ReadProp("Company")
MsgBox PropVal
End Sub
where would what you describe fit in to reveal the track changes and comments? please let me know, many thanks for your help.
nick
P.S. thanks for the print short cut, this has also been useful, but i need to how this would fit into my VBA code above (or what any new code would be if it won't)
-
Apr 18th, 2008, 11:14 AM
#4
Fanatic Member
Re: [Word 2003] Macro for reporting track changes and/or comments?
Hey nuk15. Please use the code tags when pasting code.
Code:
Sub GiveMeProperties()
Dim PropVal As String
Dim DocRevision As Revision
PropVal = ReadProp("Author")
MsgBox PropVal
PropVal = ReadProp("Company")
MsgBox PropVal
'There could be a whole lot of these.
For Each DocRevision In ActiveDocument.Revisions
If DocRevision.Author = "Red Stapler Guy" Then
MsgBox "This document is tainted!"
MsgBox DocRevision.Range.Text
DocRevision.Range.Delete
MsgBox "Taint removed!"
End If
Next
End Sub
Function ReadProp(sPropName As String) As Variant
Dim bCustom As Boolean
Dim sValue As String
On Error GoTo ErrHandlerReadProp
sValue = ActiveDocument.BuiltInDocumentProperties(sPropName).Value
ReadProp = sValue
Exit Function
ContinueCustom:
bCustom = True
Custom:
sValue = ActiveDocument.CustomDocumentProperties(sPropName).Value
ReadProp = sValue
Exit Function
ErrHandlerReadProp:
Err.Clear
If Not bCustom Then
Resume ContinueCustom
Else
ReadProp = ""
Exit Function
End If
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|