Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #17  
Old 09-08-2015, 04:16 AM
gmaxey gmaxey is offline userform help (having trouble passing info from form to macro) Windows 7 32bit userform help (having trouble passing info from form to macro) Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

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
Cyroxote, I didn't think you were making it up. I just didn't see the problem until Andrew pointed it out.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



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
userform help (having trouble passing info from form to macro) Trouble automatically running user form Lostinvba Word VBA 3 11-23-2013 07:22 PM
userform help (having trouble passing info from form to macro) 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
userform help (having trouble passing info from form to macro) Macro trouble Zack Excel 2 10-14-2010 12:07 PM
Trouble updating a form TomCaesar Outlook 0 11-29-2006 10:52 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:05 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