View Single Post
 
Old 03-30-2012, 03:21 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,496
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

Hi Nancy,

You could use:
Code:
'Replace the found text, without asking first
  Do While .Find.Found
    .Text = Split(xlRList, "|")(i)
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Even more efficient would be to replace the whole For ... Next structure with:
Code:
'Process each word from the List
Application.ScreenUpdating = False
For i = 1 To UBound(Split(xlFList, "|"))
  With ActiveDocument.Range.Find
    .Text = Split(xlFList, "|")(i)
    .Replacement.Text = Split(xlRList, "|")(i)
    .ClearFormatting
    .Replacement.ClearFormatting
    .MatchWholeWord = True
    .MatchCase = True
    .Wrap = wdFindStop
    .Execute Replace:=wdReplaceAll
  End With
Next
Application.ScreenUpdating = True
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote