#1
|
|||
|
|||
Finding and replacing fonts and styles
Hi guys,
I need some help. In my word documents, I have in the same paragraphs some parts in black, some in red and some in blue color, like below: This part is black, this part of the text is red and this is blue. The rest of the paragraph is black again. If I can put the red parts and the blue parts, inside the paragraphs, in a different style, I can use another software to classify it for me. I've realized that manually selecting the red part, for example, I can use the "headline 1" style just in this part of the paragraph. Is that possible to use a macro for changing the style in these parts, without changing the rest of the paragraphs of the text? Thank you, Adriano |
#2
|
||||
|
||||
Hi Adriano,
If you define a character Style named 'Red', for example, you can use Find/Replace to change all red text to the Red Style. The same applies to the blue text, and so on. Visually, of course, it helps if the Red Style actually formats the text in a red font. No vba required. One thing to be aware of when doing this is that applying a character Style will remove any text formatting (eg italics) that isn't part of the Style definition. You this need to consider whether you need separate Styles for normal red text, bold red text, italicized red text, etc, and do the Find/Replace with the corresponding granularity, or whether you're content to re-apply the lost formatting afterwards.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Merge documents
Hi,
Is there any way of merging documents and convert the changes into text? For example, I've this line: Original text new text old text original text again I would like to keep the blue and red colors, but convert it to text instead of that "changes links". Is that possible? I've tried to convert the doc file to pdf, but sometimes I loose the format. Thanks, Adriano |
#4
|
||||
|
||||
Hi Adriano,
Have you tried 'Compare', on the Review tab?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Yes, I've tried it. But it doesn't give me real text, but a "control of changes" option.
|
#6
|
||||
|
||||
Hi Adriano,
It is 'real' text. It's simply formatted in a way to show the differences pending a decision to accept/reject it - which you don't have to do.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Dear Paul,
Yes, I know I need to accept or reject it. But the fact is I need to work with both texts (the old and the new) in another software and when I export the document like this, the other software only recognizes the new text. Is that possible to convert both of them into text, keeping the blue and red colors? Thanks again, Adriano |
#8
|
||||
|
||||
OK, if you create the 'Red' and 'Blue' character Styles as previously discussed, you could then run the following macro:
Code:
Sub RevisionColorize() Dim i As Long With ActiveDocument .TrackRevisions = False For i = .Revisions.Count To 1 Step -1 With .Revisions(i) If .Type = wdRevisionDelete Then .Range.Style = "Red" End If If .Type = wdRevisionInsert Then .Range.Style = "Blue" .Accept End If End With Next .Revisions.RejectAll End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
Thanks a lot!
|
#10
|
|||
|
|||
Dear Paul,
Your macro is working well, but it takes too much time just to work with one single file. Is there any way of doing this faster? Thanks, Adriano |
#11
|
||||
|
||||
Quote:
Code:
Sub RevisionColorize() Application.ScreenUpdating = False Dim i As Long With ActiveDocument .TrackRevisions = False For i = .Revisions.Count To 1 Step -1 With .Revisions(i) If .Type = wdRevisionDelete Then .Range.Style = "Red" End If If .Type = wdRevisionInsert Then .Range.Style = "Blue" .Accept End If End With Next .Revisions.RejectAll End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
find & replace, font colours styles, merge, style |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Replacing texts | aslamyahya | Excel Programming | 1 | 02-27-2013 10:38 PM |
Fonts error when I used 2 types of fonts in 1 file | cmengenie | Word | 3 | 03-18-2012 02:49 PM |
Quick Styles Set saved but it doesnt appear at the styles list! | Pedro77 | Word | 3 | 10-15-2011 05:17 AM |
Word replacing problem!!!! | Jamal NUMAN | Word | 2 | 07-08-2011 03:56 AM |
Replacing default fonts | mark98101 | Word | 1 | 01-31-2011 02:31 PM |