Link to home
Start Free TrialLog in
Avatar of DCCoolBreeze
DCCoolBreeze

asked on

Word:VBA - Progammically changing tracking settings

Here is a problem that I do not know can be done.  I need to programmically (vba) change the tracking characteristics.  For example, I need to change the red characters to bold.  Is there a way that I can programmically change the settings and then change them back again?
Avatar of Joanne M. Orzech
Joanne M. Orzech
Flag of United States of America image

The easiest way to do this is to open the document, record a macro, doing a search and replace for red text, replace it with bold.

Here's something like it would look:

Sub RedToBold()
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    Selection.Find.Font.Color = wdColorRed
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Font.Bold = True
    With Selection.Find
        .Text = ""
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Avatar of DCCoolBreeze
DCCoolBreeze

ASKER

OK.  I tried that but it did not work.  I will not change the RED tracking fonts to black bold.  See I have tracking on.  What I need to do is copy and paste that document into a application that does not understand colors.  How do I manipulate the tracking corrections.
Sorry - I forgot a line:

Sub RedToBlack()
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    Selection.Find.Font.Color = wdColorRed
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find.Replacement.Font
        .Bold = True
        .Color = wdColorAutomatic
    End With
    With Selection.Find
        .Text = ""
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub
nope...still no luck.  The macro will change document text but I am trying to change the "Red Tracking Font words".  When change tracking is enabled, you get the changes in red.  These "red" changes are what I want to change.  The are displayed on the screen and they can be sent to the printer...so there must be a way to change the "red strikouts" or "red underlines" to "black bold strikeouts" or "black bold underlines"
The macro I gave you will change the red changes to black/bold...what are you using to track changes?  Word?  If you're using DeltaView, that program uses styles and you'll need a completely different solution.

If you want the red strikeouts and the red underlines (are they double underline?), we can give you a macro for all that too...but I was just getting your started.  I didn't expect my macro to do the whole thing for you.  Not being able to see what your tracking options are leaves me at a bit of a disadvantage.


Sorry - I think I see what you're talking about...will get to you in a few
One thing to do is go to Tools, Options, Revisions, and change your options from red to black.  I'm now trying to figure out how to get it bolded.
Ok - well I'm stumped.  I believe I used to be able to do this in 97 but I'm using 2000 now.  When I create a document with track changes, and the text is shown as strikethrough, then I go to Format, Font, no strikethrough is shown.  Same with underlined...very strange.  My normal method would be to search and replace but you can't search and replace what's not shown under the formatting...hmmmm

Can you use any other method?  Compare documents?  CompareRite?  DeltaView?

Avatar of Mike McCracken
In Word97 the following macro should change your tracking changes to bold
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 05/01/04 by MM
'
    With Options
        .InsertedTextMark = wdInsertedTextMarkBold
        .InsertedTextColor = wdRed
        .DeletedTextMark = wdDeletedTextMarkStrikeThrough
        .DeletedTextColor = wdByAuthor
        .RevisedPropertiesMark = wdRevisedPropertiesMarkNone
        .RevisedPropertiesColor = wdAuto
        .RevisedLinesMark = wdRevisedLinesMarkOutsideBorder
        .RevisedLinesColor = wdAuto
    End With
    With ActiveDocument
        .TrackRevisions = True
        .PrintRevisions = True
        .ShowRevisions = True
    End With
End Sub


Word97 doen't have an option for BOLD & UNDERLINE

mlmcc
SOLUTION
Avatar of Joanne M. Orzech
Joanne M. Orzech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Wow.  Thanks for the help...I will try the solution this morning...
thanks for the grade, DCCoolBreeze
:)
Rajesh