Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-09-2013, 06:03 PM
Adriano Adriano is offline Finding and replacing fonts and styles Windows 7 64bit Finding and replacing fonts and styles Office 2010 32bit
Novice
Finding and replacing fonts and styles
 
Join Date: Feb 2013
Posts: 9
Adriano is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 03-09-2013, 07:41 PM
macropod's Avatar
macropod macropod is offline Finding and replacing fonts and styles Windows 7 64bit Finding and replacing fonts and styles Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,902
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

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
[MS MVP - Word]
Reply With Quote
  #3  
Old 03-10-2013, 03:48 AM
Adriano Adriano is offline Finding and replacing fonts and styles Windows 7 64bit Finding and replacing fonts and styles Office 2010 32bit
Novice
Finding and replacing fonts and styles
 
Join Date: Feb 2013
Posts: 9
Adriano is on a distinguished road
Default 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
Reply With Quote
  #4  
Old 03-10-2013, 02:09 PM
macropod's Avatar
macropod macropod is offline Finding and replacing fonts and styles Windows 7 64bit Finding and replacing fonts and styles Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,902
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

Hi Adriano,

Have you tried 'Compare', on the Review tab?
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #5  
Old 03-10-2013, 02:12 PM
Adriano Adriano is offline Finding and replacing fonts and styles Windows 7 64bit Finding and replacing fonts and styles Office 2010 32bit
Novice
Finding and replacing fonts and styles
 
Join Date: Feb 2013
Posts: 9
Adriano is on a distinguished road
Default

Yes, I've tried it. But it doesn't give me real text, but a "control of changes" option.
Reply With Quote
  #6  
Old 03-10-2013, 02:16 PM
macropod's Avatar
macropod macropod is offline Finding and replacing fonts and styles Windows 7 64bit Finding and replacing fonts and styles Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,902
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

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
[MS MVP - Word]
Reply With Quote
  #7  
Old 03-10-2013, 03:22 PM
Adriano Adriano is offline Finding and replacing fonts and styles Windows 7 64bit Finding and replacing fonts and styles Office 2010 32bit
Novice
Finding and replacing fonts and styles
 
Join Date: Feb 2013
Posts: 9
Adriano is on a distinguished road
Default

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
Reply With Quote
  #8  
Old 03-10-2013, 04:53 PM
macropod's Avatar
macropod macropod is offline Finding and replacing fonts and styles Windows 7 64bit Finding and replacing fonts and styles Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,902
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

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
[MS MVP - Word]
Reply With Quote
  #9  
Old 03-10-2013, 05:31 PM
Adriano Adriano is offline Finding and replacing fonts and styles Windows 7 64bit Finding and replacing fonts and styles Office 2010 32bit
Novice
Finding and replacing fonts and styles
 
Join Date: Feb 2013
Posts: 9
Adriano is on a distinguished road
Default

Thanks a lot!
Reply With Quote
  #10  
Old 03-17-2013, 06:31 PM
Adriano Adriano is offline Finding and replacing fonts and styles Windows 7 64bit Finding and replacing fonts and styles Office 2010 32bit
Novice
Finding and replacing fonts and styles
 
Join Date: Feb 2013
Posts: 9
Adriano is on a distinguished road
Default

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
Reply With Quote
  #11  
Old 03-17-2013, 07:08 PM
macropod's Avatar
macropod macropod is offline Finding and replacing fonts and styles Windows 7 64bit Finding and replacing fonts and styles Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,902
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

Quote:
but it takes too much time just to work with one single file
About the only thing that can be done to make the macro run faster is to turn of screen updating while it runs:
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
[MS MVP - Word]
Reply With Quote
Reply

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
Finding and replacing fonts and styles Fonts error when I used 2 types of fonts in 1 file cmengenie Word 3 03-18-2012 02:49 PM
Finding and replacing fonts and styles Quick Styles Set saved but it doesnt appear at the styles list! Pedro77 Word 3 10-15-2011 05:17 AM
Finding and replacing fonts and styles Word replacing problem!!!! Jamal NUMAN Word 2 07-08-2011 03:56 AM
Finding and replacing fonts and styles Replacing default fonts mark98101 Word 1 01-31-2011 02:31 PM


All times are GMT -7. The time now is 06:21 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft