This site uses cookies.
Some of these cookies are essential to the operation of the site,
while others help to improve your experience by providing insights into how the site is being used.
For more information, please see the ProZ.com privacy policy.
Samuel Murray Netherlands Local time: 20:10 Member (2006) English to Afrikaans + ...
Oct 20, 2016
Hello everyone
Does anyone know of a macro that will modify a tracked changes document in MS Word so that it adds curly brackets on either side of a deletion and square brackets on either side of an insertion?
It doesn't matter to me if the brackets close whole chunks of deletions or insertions, or deleted or inserted characters individually, nor does it matter to me if the tracks remain intact and/or if the brackets are tracked.
Does anyone know of a macro that will modify a tracked changes document in MS Word so that it adds curly brackets on either side of a deletion and square brackets on either side of an insertion?
It doesn't matter to me if the brackets close whole chunks of deletions or insertions, or deleted or inserted characters individually, nor does it matter to me if the tracks remain intact and/or if the brackets are tracked.
Here are two examples of what I'm looking for (any of the 6 options shown under the example would be acceptable to me, though I would prefer the third one, i.e. nothing in tracks anymore, and whole tracked sections bracketed):
I need this so that I can add tracked text to my TM.
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
Samuel Murray Netherlands Local time: 20:10 Member (2006) English to Afrikaans + ...
TOPIC STARTER
One option
Oct 20, 2016
Samuel Murray wrote: Does anyone know of a macro that will modify a tracked changes document in MS Word so that it adds curly brackets on either side of a deletion and square brackets on either side of an insertion?
This one works, but only on short documents, and it sometimes forgets to process the last deletion/insertion in the file:
Number = ActiveDocument.Revisions.Count For x = 1 To Number Set myRev = ActiveDocument.Revisions(x).Range This = ActiveDocument.Revisions(x).Type If This = 2 Then myRev.Select Selection.InsertAfter "›" Selection.InsertBefore "‹" End If If This = 1 Then myRev.Select Selection.InsertAfter "»" Selection.InsertBefore "«" End If Next x
Dim chgAdd As Word.Revision
ActiveDocument.TrackRevisions = False
For Each chgAdd In ActiveDocument.Revisions If chgAdd.Type = wdRevisionDelete Then chgAdd.Reject ElseIf chgAdd.Type = wdRevisionInsert Then chgAdd.Accept End If Next chgAdd
End Sub
Subject:
Comment:
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
CafeTran Training (X) Netherlands Local time: 20:10
XML
Oct 20, 2016
How about going for the xml inside the docx zip package?
Subject:
Comment:
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
Rolf Keller Germany Local time: 20:10 English to German
Optimize the macro
Oct 21, 2016
Samuel Murray wrote:
This one works, but only on short documents
Maybe some code parts run to slow and produce racing conditions.
(1) Suppress unnecessary screen updates by encapsulating the code:
Sub tracks2brackets() Application.ScreenUpdating = False ... your existing Sub body goes here ... Application.ScreenUpdating = True end Sub
(2) Make the code faster by using only one insert instead of two:
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
Samuel Murray Netherlands Local time: 20:10 Member (2006) English to Afrikaans + ...
TOPIC STARTER
@Rolf
Oct 21, 2016
Rolf Keller wrote: (2) Make the code faster by using only one insert instead of two: Replace Selection.InsertAfter "›" Selection.InsertBefore "‹" by Selection = "‹" + Selection + "›"
Thanks, but... unfortunately, if I do this, then the macro only works on deletions, and it ignores insertions.
(1) Suppress unnecessary screen updates by encapsulating the code:
Sub tracks2brackets() Application.ScreenUpdating = False ... your existing Sub body goes here ... Application.ScreenUpdating = True end Sub
This seems to have an effect but since the screen doesn't update, it becomes difficult to tell whether Word is still working.
Subject:
Comment:
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
Rolf Keller Germany Local time: 20:10 English to German
Macro enhancements, continued
Oct 21, 2016
Samuel Murray wrote:
if I do this, then the macro only works on deletions, and it ignores insertions.
I swapped the angle brackets, sorry.
since the screen doesn't update, it becomes difficult to tell whether Word is still working.
The standard solution for this is a messagebox. Just insert MsgBox "Done!" at the end.
Subject:
Comment:
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
The leading translation software used by over 270,000 translators.
Designed with your feedback in mind, Trados Studio 2022 delivers an unrivalled, powerful desktop
and cloud solution, empowering you to work in the most efficient and cost-effective way.
Exclusive discount for ProZ.com users!
Save over 13% when purchasing Wordfast Pro through ProZ.com. Wordfast is the world's #1 provider of platform-independent Translation Memory software. Consistently ranked the most user-friendly and highest value