Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Word:VBA - Progammically changing tracking settings

Posted on 2004-04-29
12
Medium Priority
?
1,164 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
[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

 
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 101

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
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…
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) …
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
Suggested Courses

824 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