Track changes in MS Word

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!!

 

Greetings,

Densetsu

Haven’t tested it but if find/replace is what you’re after then maybe:

https://gallery.technet.microsoft.com/7c463ad7-0eed-4792-8236-38434f891e0e

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.

https://docs.microsoft.com/en-us/office/vba/api/word.revisions
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.

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.