This topic contains 3 replies, has 3 voices, and was last updated by
September 20, 2018 at 11:54 am #112186ParticipantPoints: 0Rank: Member
Dear all, I am quite new to PowerShell but know my way around the basics. Yet, I still have not been able to find whether it is even possible to track changes in MS Word through PowerShell script.
I already have a look&replace string written. It looks for a word, and replaces it with another, in MS Word. Now I need to know whether it is possible to highlight that word in some way, so that I can later open each of the Word files and make any necessary edits around that word.
Any help greatly appreciated!!
September 20, 2018 at 12:54 pm #112198ParticipantPoints: 5Rank: Member
Haven't tested it but if find/replace is what you're after then maybe:
September 20, 2018 at 5:57 pm #112211ParticipantPoints: 37Rank: Member
Track changes is a MSOffice feature not a PS one.
You can't track changes to a doc via PS. You can track document modifications by creating hashes of files when they are created and then doing a hash check again at a later date and compare. If the hash is different the document was changed.
The hash won't tell you what was changed, jus that that calculation will show it has. To see what actually was changed, you need to do a compare between the two docx, and take actions on the results.
Or, use the Office Object model and use the MSWord RevisionObject to see if you can leverage that for what you are after.
If you mean, highlight the word you changed in the docx via the script, then Words track changes, if set should do that automatically, because you have to open Word to change the docx, and whatever Word settings are in place for your profile, should have impact, otherwise, you'd use the OOM to set the color on the change yourself manually.
September 24, 2018 at 8:16 am #112490ParticipantPoints: 0Rank: Member
Hi all, I just wanted to thank you for the suggestions! I found a way to track the changes:
$objDoc.TrackRevisions = $true
$objDoc.ShowRevisions = $true
When tracked with this, they look exactly like they do if you did it directly through MS Word.
You must be logged in to reply to this topic.