Solved

Word:VBA - Progammically changing tracking settings

Posted on 2004-04-29
12
1,130 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

 
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
 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
If you work with Word a lot, you probably use styles. If you use styles a lot, you've probably balled your fist more often than not when working with the ribbon. In Word 2007/2010, one of the things that I find missing when using styles is a quic…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
Suggested Courses

751 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