Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2006

Tip: Looking for answers? Try searching our database.

Some font attributes work and some don't

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Greg Maxey - 02 Feb 2006 23:53 GMT
I am working on a macro that will change the formatting of revision in a track change document.  Say the deletions are Red and strikethrough and insertions are Blue and italic.

I want to change the formatting of deletions to bold with no strikethrough and insertions as Red with stikethrough (odd choice I know).  I have the following code that "does" bold the deletions and "does" strikethrough the insertions, but the other coded changes (removing strikethrough and changing color) are not working.

Can anyone offer an explanation why?  Thanks.

Sub Change()
Dim oTrk As Revision
ActiveDocument.TrackRevisions = False
For Each oTrk In ActiveDocument.Range.Revisions
Select Case oTrk.Type
 Case wdRevisionDelete
   With oTrk.Range.Font
     .Bold = True
     .StrikeThrough = False
   End With
 Case wdRevisionInsert
   With oTrk.Range.Font
     .StrikeThrough = True
     .Color = wdRed
   End With
 Case Else
   'Do Nothing
End Select
Next
End Sub

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Jay Freedman - 03 Feb 2006 04:34 GMT
Hi Greg,

The problem is that the "formatting" of revisions is completely
separate from the ordinary font formatting of the text. So when you
apply changes to oTrk.Range.Font, those changes are being added to the
revision marking, not replacing it.

The following snippet will change all the addition and deletion
marking in the whole document without having to iterate through the
Revisions collection:

   With Options
       .InsertedTextColor = wdRed
       .InsertedTextMark = wdInsertedTextMarkStrikeThrough
       .DeletedTextColor = wdAuto
       .DeletedTextMark = wdDeletedTextMarkBold
   End With

Things like this illustrate why it isn't enough to know how to program
in VBA to automate Word -- you also have to know the details of how
almost every feature is implemented. :-(

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

>I am working on a macro that will change the formatting of revision in a track change document.  Say the deletions are Red and strikethrough and insertions are Blue and italic.
>
[quoted text clipped - 22 lines]
>Next
>End Sub
Greg Maxey - 03 Feb 2006 04:41 GMT
Jay,

Thanks.   This is a clear case of not seeing the tree for the forest.  I
could have refered to my own website for the solution:
http://gregmaxey.mvps.org/put_track_changes_in_word2002_back_on_track.htm

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> Hi Greg,
>
[quoted text clipped - 50 lines]
>> Next
>> End Sub

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.