![]() |
#17
|
|||
|
|||
![]()
Andrew,
Good catch! I was lazy and copied his test document content into his template and didn't get that result. Copying his code into his text document though and the loop appeared. Instead of removing it, I would change the code as follows: Code:
Private Sub DoColorChange(SearchColor As Long, ReplaceColor As Long) Dim oDoc As Document Dim oRng As Range Set oDoc = ActiveDocument Set oRng = oDoc.Range With oRng.Find .Highlight = True .Wrap = wdFindStop Do While oRng.Find.Execute If oRng.HighlightColorIndex = SearchColor Then oRng.HighlightColorIndex = ReplaceColor End If oRng.Collapse wdCollapseEnd If oRng.End = ActiveDocument.Range.End - 1 Then Exit Do Loop End With End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to copy cell info to multiple documents | Patrick Innes | Word VBA | 2 | 02-18-2015 08:38 PM |
![]() |
Lostinvba | Word VBA | 3 | 11-23-2013 07:22 PM |
![]() |
blockie | Mail Merge | 8 | 11-13-2013 11:28 PM |
![]() |
Zack | Excel | 2 | 10-14-2010 12:07 PM |
Trouble updating a form | TomCaesar | Outlook | 0 | 11-29-2006 10:52 AM |