View Single Post
 
Old 07-19-2016, 06:41 AM
Robert K S Robert K S is offline Windows 7 64bit Office 2007
Novice
 
Join Date: Jul 2016
Location: Cleveland, Ohio
Posts: 10
Robert K S is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
It appears the OP is not a fan of Words Revision Tracking so they are doing it manually.
Yes, for certain legal document applications the revision tracking doesn't cut the mustard, and the changes have to be shown in plain old underline and strikethrough. In such a regime you generally don't want stricken-through deleted text abutting right up against underlined inserted text, thus, some whitespace has to come between, as opposed to Word's revision tracking which would not have such whitespace. To make things more complicated, certain deletions have to be denoted by double brackets, as when deleting [[-]] hyphens, dashes, etc., which wouldn't otherwise be distinguishable from deleting whitespace, or otherwise when deleting small sets of characters where strikethrough would not be noticeable (e.g., striking through a single e or 4).

I've been developing a different VBA script that converts Word's revision tracking to legal-document revision format, but it's not perfect yet. I'm particularly having trouble with the part of the script that adds and deletes spaces, as appropriate, around double brackets where they have been inserted as part of the conversion process. Here's my crummy code that doesn't work, in case anyone's really interested. I think I was trying to write this before I understood fully what could be done with wildcard search & replace and I would probably do it differently now.

Code:
    For Each strChar In Selection.Range.Characters 'Add/delete spaces around double brackets
        Set strPrevPrevChar = strChar.Previous(wdCharacter, 2) 'I don't think this works
            MsgBox "Nothing selected or no revisions in selection.", vbOKOnly
        Set strPrevChar = strChar.Previous(wdCharacter, 1)
        Set strNextChar = strChar.Next(wdCharacter, 1)
        Set strNextNextChar = strChar.Next(wdCharacter, 2) 'I don't think this works
        If strChar.Text = "[" And strNextChar.Text = "[" Then 'Opening double bracket
            If strPrevChar.Text <> Chr(32) Then 'Insert leading space before opening double bracket
                strChar.InsertBefore (" ")
            Else 'Make sure there is only one leading space before opening double bracket
                Do While strPrevChar.Text = Chr(32)
                Loop
            End If
            Do While strNextNextChar.Text = Chr(32) 'Delete leading space after opening double bracket
                
            Loop
        ElseIf strChar.Text = "]" And strNextChar.Text = "]" Then 'Closing double bracket
            If strNextNextChar.Text <> Chr(32) Then 'Insert trailing space after closing double bracket
            End If
        End If
    Next strChar
PS
Thanks everybody for your help. Really fantastic answers here.
Reply With Quote