Can I count the number of replaced texts in VBA

Brass Contributor


I am changing all instances of text1 to text2 in my document in VBA.

The change itself is very easy

Set WordRange = ActiveDocument.Content

WordRange.Find.Execute FindText:="Text1", ReplaceWith:="Text2", Replace:=wdReplaceAll


But I want to know how many replacements were made.

Is there any way of finding this out?


2 Replies
best response confirmed by Gilgamesh1964 (Brass Contributor)


Thank you.

An interesting way of doing it.

I will have a play with this

1 best response

Accepted Solutions