regex - Word Regular Expression Macro Messes with Formatting -
i have created ms word macro makes replacements .csv. macro makes replacements correctly, messes formatting. document becomes entirely left-aligned , made bold.
dim mystring string dim strarray() string open "example.csv" input #1 while not eof(1) line input #1, mystring strarray = split(mystring, ",") dim re object set re = createobject("vbscript.regexp") re .multiline = false .global = true .ignorecase = false .pattern = "(\w)" & (strarray(0)) & "(\w)" end selection = re.replace(selection, "$1" & strarray(1) & "$2") loop close #1 before run macro select text. document have been testing contains bold text. thank help.
Comments
Post a Comment