SOLVED

Can I count the number of replaced texts in VBA

Brass Contributor

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

2 Replies
best response confirmed by Gilgamesh1964 (Brass Contributor)

@Stefan_Blom 

Thank you.

An interesting way of doing it.

I will have a play with this

1 best response

Accepted Solutions