Forum Discussion

Gilgamesh1964's avatar
Gilgamesh1964
Brass Contributor
Feb 10, 2021

Can I count the number of replaced texts in VBA

Hi,

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?

Thanks

Resources