Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word 2007 - Converting Track Changes to underline and strike

Status
Not open for further replies.

CivilHack

Technical User
Oct 19, 2010
3
US
MakeItSo posted some very useful code a couple years ago to take Word track changes and convert them to hard formatted strikout and underline. ( have some documents that include formulas, which I think may be treated as inline shapes. I am now trying to modifiy the aforementioned code to differentiate between deleted text and deleted inline shapes.Thanks in advance
 
Hi CivilHack,

I just checked with Word 2007: a formula is not treated as an inline shape but as an "OMath" object.

So amending the "deleted" portion of my code like this should do the trick:
Code:
Case wdRevisionDelete
            'secure "deleted" text as well as its position
            [b]
            If rev.Range.OMaths.Count > 0 Then
                txt = "Formula Object"
            Else
                txt = rev.Range.Text
            End If[/b]
            r = rev.Range.Start
            'accept the revision to make the markup disappear
            rev.Accept
            'now type the text formatted as strikethrough at the position of the old text
            Set ran = ActiveDocument.Range(r, r)
            With ran
                .Text = txt
                .Font.StrikeThrough = 1
            End With
Now if a deleted formula is encountered, the code should insert a striked-through "Formula Object" at that position.

Would that do?
;-)

Cheers,
MakeItSo


[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Hi and thanks,
This is definately getting me in the right direction. For some reason my formulas are being treated as InLineShapes. When I try to edit them in word it says the server application cannot be found. I think in 2007 the math editing function is included, but I just read that if the formula was created in a previous version then you need ot use that add-in from 2003. So I added to your code:

Code:
            If rev.Range.OMaths.Count > 0 Then
                txt = "Formula Object"
            ElseIf rev.Range.InLineShapes.Count > 0 Then
                txt = "Deleted Shape"
            Else
                txt = rev.Range.Text
            End If

but what I would really like to do is capture the equation/shape accept it and paste it back as strikethrough. That's what I am working on now.

Thanks again!
 

Looked in VBA Help. These Methods may be of interest.
Word Developer Reference
OMath Object Members

Represents an equation. OMath objects are members of the OMaths collection.

Methods

Name Description
BuildUp Converts an equation to professional format.
ConvertToLiteralText Converts an equation to literal text.
ConvertToMathText Converts an equation to math text.
ConvertToNormalText Converts an equation to normal text.

Linearize Converts an equation to linear format.
Remove Removes an equation from the collection of equations in a document, range, or selection.


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top