View Single Post
 
Old 01-01-2024, 10:54 AM
ctviggen ctviggen is offline Windows 10 Office 2016
Advanced Beginner
 
Join Date: Feb 2021
Posts: 54
ctviggen is on a distinguished road
Default

Sorry, I got waylaid by other items, mainly family issues. Thank you for the input. I finally got back to looking at this.

Let's ignore the cross-referencing for now, since you point out the issues with that. (Thank you for the explanation.)

For the manipulation of text in the newDoc, this is a simple find and replace (e.g., replace the word X with the word Y or change the snippet "A B C" to "C D E F G", where the capital letters are words).

Normally, I do something like this for the original document (with a section selected):

Code:
    ' Replaces tab character with two spaces
    With Selection.Find
        .Text = "^t"
        .Replacement.Text = "  "
        .Forward = True
        .Wrap = wdFindStop
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    ' I think this actually causes the replacement to happen
     Selection.Find.Execute Replace:=wdReplaceAll

This is just one example where I replace a tab character with two spaces.

How do I perform the same replacement in newDoc, then copy all the (modified) text there back into the original document?
Reply With Quote