![]() |
|
#7
|
|||
|
|||
|
I did the test as you suggested, and that got stuck in the endless loop, as did your alternate version. I'm using Word 2007, if that makes a difference.
My macro worked apart from the form when SearchColor and ReplaceColor were dimensioned as String, not Long. That's the only big difference I can see between this and the last working version. So I changed them back to strings: Code:
Private Sub DoColorChange(SearchColor As String, ReplaceColor As String)
Dim oDoc As Document
Dim oRng As Range
Set oDoc = ActiveDocument
Set oRng = oDoc.Range
With oRng.Find
.Highlight = True
Do While oRng.Find.Execute
If oRng.HighlightColorIndex = SearchColor Then
oRng.HighlightColorIndex = ReplaceColor
End If
oRng.Collapse 0
Loop
End With
End Sub
Sub Macro50()
DoColorChange wdYellow, wdPink
End Sub
I went all the way back to the first one I posted, and now it TOO has the endless loop. This is puzzling. |
|
|
Similar Threads
|
||||
| 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 |
Trouble automatically running user form
|
Lostinvba | Word VBA | 3 | 11-23-2013 07:22 PM |
I'm having trouble creating a Merge using label form and placing a shape in the text
|
blockie | Mail Merge | 8 | 11-13-2013 11:28 PM |
Macro trouble
|
Zack | Excel | 2 | 10-14-2010 12:07 PM |
| Trouble updating a form | TomCaesar | Outlook | 0 | 11-29-2006 10:52 AM |