Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-06-2020, 04:01 AM
1van 1van is offline Accept/reject tracked changes in word and retain font color/formatting Windows 10 Accept/reject tracked changes in word and retain font color/formatting Office 2016
Novice
Accept/reject tracked changes in word and retain font color/formatting
 
Join Date: Nov 2015
Posts: 4
1van is on a distinguished road
Default Accept/reject tracked changes in word and retain font color/formatting

Hello,


I have been using a macro that accepts tracked insertions and leaves the formatting of the text (blue):


Sub acceptChanges()
Dim oRev As Revision
For Each oRev In ActiveDocument.Revisions
If oRev.Type = wdRevisionInsert Then
oRev.Range.Font.Color = wdColorBlue
End If
oRev.Accept
Next


End Sub


but in this case the deletions (red text) is removed from the document, so my question is: is there a way to make a single macro that will simultaneously find insertions (blue text) accept them, and leave them blue, but if it finds deletions they would be rejected and left red/strike-trough? Because I cant make it happen...
Reply With Quote
  #2  
Old 07-06-2020, 02:22 PM
gmaxey gmaxey is online now Accept/reject tracked changes in word and retain font color/formatting Windows 10 Accept/reject tracked changes in word and retain font color/formatting Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,422
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

I think you just need to move your oRev.Accept inside the If ... End If code.


Code:
Sub acceptChanges()
Dim oRev As Revision
  For Each oRev In ActiveDocument.Revisions
    If oRev.Type = wdRevisionInsert Then
      oRev.Range.Font.Color = wdColorBlue
      oRev.Accept
    End If
  Next
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 07-06-2020, 04:15 PM
Guessed's Avatar
Guessed Guessed is offline Accept/reject tracked changes in word and retain font color/formatting Windows 10 Accept/reject tracked changes in word and retain font color/formatting Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Greg's suggestion takes care of your inserted text. To also deal with the deleted text you need to add a condition for it
Code:
Sub acceptChanges()
  Dim oRev As Revision
  For Each oRev In ActiveDocument.Revisions
    If oRev.Type = wdRevisionInsert Then
      oRev.Range.Font.Color = wdColorBlue
      oRev.Accept
    ElseIf oRev.Type = wdRevisionDelete Then
      oRev.Range.Font.Color = wdColorRed
      oRev.Range.Font.StrikeThrough = True
      oRev.Reject
    End If
  Next
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #4  
Old 07-08-2020, 06:02 AM
1van 1van is offline Accept/reject tracked changes in word and retain font color/formatting Windows 10 Accept/reject tracked changes in word and retain font color/formatting Office 2016
Novice
Accept/reject tracked changes in word and retain font color/formatting
 
Join Date: Nov 2015
Posts: 4
1van is on a distinguished road
Default

Guessed & gmaxey thank you so much! Works exactly as intended
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accept/reject tracked changes in word and retain font color/formatting Word 16/19 change font and outside border color (same color) eg is red change to pink jec1 Word VBA 2 12-04-2019 11:32 PM
Word (Windows) cannot accept/reject edits from Word (Mac) Michael Graubart Word 0 07-24-2019 04:04 AM
Accept/reject tracked changes in word and retain font color/formatting Hyperlink style won't accept font color or underlining Jennifer Murphy Word 14 03-19-2017 03:02 PM
Advanced Font Color Manipulation In Word: Inserting another color than the surrounding text stuartg Word 1 02-20-2017 12:38 AM
Font Color Question//.Replacement.Font.Color = 12611584 rsrasc Word VBA 3 09-05-2015 09:03 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:20 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft