The script below uses RegEx to find and replace within a Word selection. The problem is that many times, depending how the text is formatted, it changes this formatting style.
How can I search and replace (using RegEx) while keeping everything else intact?
Thank you!
Alex
Code:
Dim RegEx As Object
Set RegEx = CreateObject("vbscript.RegExp")
With RegEx
.pattern = "old_text"
.Global = True
Selection.Text = .replace(Selection.Text, "new_text")
End With