Solved

Word:VBA - Progammically changing tracking settings

Posted on 2004-04-29
12
1,112 Views
Last Modified: 2008-02-01
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?
0
Comment
Question by:DCCoolBreeze
  • 6
  • 3
  • 2
  • +1
12 Comments
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 10959693
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
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 10961544
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.
0
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 10961858
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
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 10962705
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"
0
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 10963049
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
0
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 10963222
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.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 10963575
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?

0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10967728
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
0
 
LVL 37

Assisted Solution

by:Joanne M. Orzech
Joanne M. Orzech earned 250 total points
ID: 10967770
DCCoolBreeze - I've enlisted the help of all experts on EE to help resolve your problem.  Looks like we might have a solution! Many thanks Michael.
0
 
LVL 24

Accepted Solution

by:
R_Rajesh earned 250 total points
ID: 10968615
You might also want to consider making use of the document's revisions property.

Open your document with revisions, make sure the current view is showing the revisions, hit alt+f11, this opens the vbe window, here select module form the insert menu and paste the code below. Close the vbe window, back in word hit alt+f8, select customTc and click on run.

The code creates a duplicate document, goes through each revisions in the document. It bolds all the revisions (red text), underlines all the tracked additions (red underlines) and strikes all the tracked deletions (red strikethrough)

'-------------------
Sub customTC()
Dim wDoc As Word.Document, tDoc As Document, mrev As Revision
Set tDoc = ActiveDocument
If tDoc.TrackRevisions = True Then
Set wDoc = Documents.Add
wDoc.Content = tDoc.Content
For Each mrev In tDoc.Revisions
With wDoc.Range(mrev.Range.Start, mrev.Range.End).Font
.Size = .Size + 1: .Bold = True
.StrikeThrough = (mrev.Type = 2): .Underline = (mrev.Type = 1)
End With
Next mrev
End If
Set wDoc = Nothing: Set tDoc = Nothing
End Sub
'--------------------

Rajesh
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 10976550
Wow.  Thanks for the help...I will try the solution this morning...
0
 
LVL 24

Expert Comment

by:R_Rajesh
ID: 10982668
thanks for the grade, DCCoolBreeze
:)
Rajesh
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now