Processing
 

Using word wildcards to find unaccepted changes

19/09/2016 10:15#1

Joined at: 5 months ago

Post: 1

Thank: 0

Thanked: 0

I have some word documents with unaccepted, tracked changes. I want to accept them but still have them shown in red in my documents. I think a good way to do this would be doing a wildcard search for unaccepted changes and replacing them with the same text in red, however I dont know if this is possible. I am also happy with other ways of achieving my goal, without wildcards.

19/09/2016 13:53Top#2

Joined at: 11 months ago

Post: 247

Thank: 0

Thanked: 0

Applying formatting to revisions cannot be done using Word's standard find & replace operation. However, you can write a macro that enumerates all revisions and then applies formatting to each of them.

There is a bloc post by Chris Rae who provides a macro that converts revisions to standard formatting:

Enumerating edits on large documents (AKA converting tracked changes to conventional formatting)

The macro may not yet do exactly what you need, but it should get you started.

For reference, here is a copy of the macro:

Sub EnumerateChanges()     Dim rAll As Revision     Dim dReport As Document     Dim dBigDoc As Document      Set dBigDoc = ActiveDocument      If dBigDoc.Revisions.Count = 0 Then         MsgBox "There are no revisions in the active document.", vbCritical     ElseIf MsgBox(“This will enumerate the changes in '" + dBigDoc.Name + "' in a new document and close the original WITHOUT saving changes. Continue?", vbYesNo) <> vbNo Then         Set dReport = Documents.Add          dBigDoc.Activate ' really just so we can show progress by selecting the revisions         dBigDoc.TrackRevisions = False ' Leaving this on results in a disaster          For Each rAll In dBigDoc.Revisions             ' Now find the nearest section heading downwards             Dim rFindFirst As Range, rFindLast As Range             Set rFindLast = rAll.Range.Paragraphs(1).Range             While Not IsNumberedPara(rFindLast.Next(wdParagraph))                 Set rFindLast = rFindLast.Next(wdParagraph)             Wend             ' Now head back up to the next numbered section header             Set rFindFirst = rFindLast             Do                 Set rFindFirst = rFindFirst.Previous(wdParagraph)             Loop Until IsNumberedPara(rFindFirst) Or (rFindFirst.Previous(wdParagraph) Is Nothing)             ConvertNumberedToText rFindFirst              Dim rChangedSection As Range             Set rChangedSection = dBigDoc.Range(rFindFirst.Start, rFindLast.End)             ' Properly tag all the revisions in this whole section             Dim rOnesInThisSection As Revision             For Each rOnesInThisSection In rChangedSection.Revisions                 rOnesInThisSection.Range.Select ' just for visual update                 DoEvents ' update the screen so we can see how far we are through                 If rOnesInThisSection.Type = wdRevisionDelete Then                     rOnesInThisSection.Reject                     With Selection.Range                         .Font.ColorIndex = wdRed                         .Font.StrikeThrough = True                     End With                     dBigDoc.Comments.Add Selection.Range, “deleted”                 Else                     If rOnesInThisSection.Type = wdRevisionInsert Then                         rOnesInThisSection.Accept                         With Selection.Range                             .Font.ColorIndex = wdBlue                         End With                         dBigDoc.Comments.Add Selection.Range, “inserted”                     End If                 End If             Next              ' Now copy the whole thing into our new document             rChangedSection.Copy             Dim rOut As Range             Set rOut = dReport.Range             rOut.EndOf wdStory, False             rOut.Paste         Next rAll          ' There should end up being no numbered paragraphs at all in the          ' new doc (they were converted to text), so delete them         Dim pFinal As Paragraph         For Each pFinal In dReport.Paragraphs             If IsNumberedPara(pFinal.Range) Then                 pFinal.Range.ListFormat.RemoveNumbers             End If         Next          dBigDoc.Close False     End If End Sub  Sub ConvertNumberedToText(rOf As Range)     If InStr(rOf.ListFormat.ListString, “.”) > 0 Then         rOf.InsertBefore "Changes to section " + rOf.ListFormat.ListString + " "     End If End Sub  Function IsNumberedPara(rOf As Range) As Boolean     If rOf Is Nothing Then ‘ if the document doesn’t have numbered sections, this will cause changes to be enumerated in the whole thing         IsNumberedPara = True     ElseIf rOf.ListFormat.ListString <> "" Then         If Asc(rOf.ListFormat.ListString) <> 63 Then             IsNumberedPara = True         End If     End If End Function 
Similar articles

VBA regex matching over two lines

5 months ago - Reply: 1 - Views: 44

Table output to Word-2011 from Rstudio using knit

5 months ago - Reply: 0 - Views: 44

Write a Collection of paragraphs into a new document

5 months ago - Reply: 1 - Views: 72

how to write paragraphs without show to document

5 months ago - Reply: 1 - Views: 67

numericals in word macro

5 months ago - Reply: 1 - Views: 46

Can not find proofing tools

5 months ago - Reply: 0 - Views: 2

Possible values for <w:outlineLvl> in Word OOXML

5 months ago - Reply: 1 - Views: 8

C# restrict editing partial word paragraph

6 months ago - Reply: 2 - Views: 146

Macro translation Please (possible virus)

5 months ago - Reply: 1 - Views: 35

Doc/Docx Fastest Reading Method for Searching

5 months ago - Reply: 0 - Views: 3

Save embedded file / content from word

5 months ago - Reply: 0 - Views: 6

Counting words in Word document, including footnores

5 months ago - Reply: 1 - Views: 24

c# access extract word ole object

5 months ago - Reply: 1 - Views: 23

Using word wildcards to find unaccepted changes

5 months ago - Reply: 1 - Views: 46

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re