Want to see the find/replace operation

M

mehdi

I have made a vb code to search and replace a word from suggested list
(similar to that of spell checker/replacement suggestions). The code
works fine, but I want to see the word for which replacement is being
asked. All my code does is to display suggestion list, replacewith the
selected without showing where in the document that replacemnet is
being carried out. can anyone help?
my code looks like this

..MatchWholeWord = True
..Execute FindText:=FindWord, ReplaceWith:=SuggestionList.Value,
Format:=True, _
Replace:=wdReplaceOne
 
M

mehdi

I think some command like 'refresh view' should work, but could notfind
any such command
 
H

Helmut Weber

Hi Mehdi,

quoting dear Greg,
something along these lines.

Sub Test4454()
Dim rngDcm As Range
Dim lngRsl As Long
Set rngDcm = ActiveDocument.Range
With rngDcm.Find
.Text = "fox"
While .Execute
rngDcm.Select
lngRsl = MsgBox("YesNo", vbYesNoCancel)
If lngRsl = vbYes Then
rngDcm.Text = "fix"
rngDcm.Collapse Direction:=wdCollapseEnd
ElseIf lngRsl = vbCancel Then
Exit Sub
End If
Wend
End With
End Sub

But there is more to it than meets the eyes,
as e.g. the replacement text could
contain the replaced text again.


HTH

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top