Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-04-2016, 04:41 PM
macropod's Avatar
macropod macropod is offline VBA Word - Find Text  Font Color - Insert New Text Windows 7 64bit VBA Word - Find Text  Font Color - Insert New Text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try something based on:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim ArrClr, ArrPref, ArrSuff, i As Long
ArrClr = Array(RGB(255, 0, 102), RGB(0, 176, 240))
ArrPref = Array("[KEEP]" & vbCrLf, "[MOVE]" & vbCrLf)
ArrSuff = Array("[END]" & vbCrLf, "[END]" & vbCrLf)
With ActiveDocument.Range.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Forward = True
  .Wrap = wdFindContinue
  .MatchCase = False
  .MatchWholeWord = False
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = False
  For i = 0 To UBound(ArrClr)
    .Font.Color = ArrClr(i)
    .Replacement.Text = ArrPref(i) & "^&" & ArrSuff(i)
    .Execute Replace:=wdReplaceAll
  Next
End With
Application.ScreenUpdating = True
End Sub
I haven't incorporated your "[EDIT]"/"[END]" code as you've already used its colours for your "[KEEP]"/"[END]" code.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Word - Find Text  Font Color - Insert New Text Remove white text background (keeping the font color and page color intact cc3125 Word 1 10-26-2015 06:44 PM
Is there an option to choose font color when replacing text in Excel 2003? chr2014 Excel 8 11-14-2014 09:13 PM
how to search and replace BOLD text >> font color change? dylansmith Word 4 03-12-2013 09:51 PM
text color and font buttons gblackstien Word 0 09-25-2012 05:19 AM
VBA Word - Find Text  Font Color - Insert New Text Hwo to insert text of a different font by default cgott42 Word 2 08-19-2012 09:00 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:44 PM.


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