VBA macro to replace text line by line
Posted on 2014-12-13
I am using the following macro to replace bolded text in my document.
.Font.Bold = True
.Font.Bold = TRUE
.Execute FindText:="Comment", ReplaceWith:="ReplacementComment", _
This works perfectly, but the code is called several times and I am running into the problem of having the text replaced more than once (it changes to the new text, but on the next call it changes it again to something else - not the desired behaviour).
Instead of wdReplaceAll (the whole document) how do I find and replace the bold text line by line (one line per call)? The routine is called with parameters ("comment", "replacementcomment") and those values are read from arrays in a loop.