How to find all text in wdRed and then change to wdBlack, with track changes?

yanlok1345
StarLounger
Posts: 74
Joined: 18 Oct 2023, 14:48

How to find all text in wdRed and then change to wdBlack, with track changes?

Post by yanlok1345 »

Hello everyone,

I utilized a word macro to replace all text in wdREd with wdBlack. Despite including the line ActiveDocument.TrackRevisions = True, the tracked changes are not visible after executing the macro. I would appreciate any assistance in resolving this issue. Thank you kindly for your support!

Code: Select all

Sub RedToBlack()

    ActiveDocument.TrackRevisions = True
    Dim rng As Range
    Set rng = ActiveDocument.Content
    
    With rng.Find
        .ClearFormatting
        .Font.ColorIndex = wdRed
        .Replacement.ClearFormatting
        .Replacement.Font.ColorIndex = wdBlack
        .Execute Replace:=wdReplaceAll
    End With
    
End Sub

User avatar
HansV
Administrator
Posts: 78530
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to find all text in wdRed and then change to wdBlack, with track changes?

Post by HansV »

It looks like Word (in Microsoft 365 at least) does not track formatting changes applied by a macro.
You can report this: File > Feedback > Send a Frown
Best wishes,
Hans

yanlok1345
StarLounger
Posts: 74
Joined: 18 Oct 2023, 14:48

Re: How to find all text in wdRed and then change to wdBlack, with track changes?

Post by yanlok1345 »

HansV wrote:
09 Jan 2024, 16:28
It looks like Word (in Microsoft 365 at least) does not track formatting changes applied by a macro.
You can report this: File > Feedback > Send a Frown
Thank you for your reply. I am using company's computer and we are not allowed to give feedback to Microsoft. I found out that is the problem of coding in VBA. I solved it by using boolean and RT for ActiveDocument.TrackRevision.

Again, many thanks for your help every time! :thankyou:

User avatar
Charles Kenyon
5StarLounger
Posts: 621
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: How to find all text in wdRed and then change to wdBlack, with track changes?

Post by Charles Kenyon »

Perhaps you want to give feedback to your IT department to pass on to Microsoft?

User avatar
Charles Kenyon
5StarLounger
Posts: 621
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: How to find all text in wdRed and then change to wdBlack, with track changes?

Post by Charles Kenyon »

Cross-posted at: https://www.msofficeforums.com/word-vba ... track.html
For cross-posting etiquette, please read: A Message to Forum Cross-Posters
https://www.excelguru.ca/content.php?184