Thu Jun 11, 2015 1:48 am
Hi burning.liu
Thank you for this, it did finally work, however I found another bug, I think, in the Replace function with the latest hotfix. In the same file, if the string to replace is less thatn 5 characters in length, the following error occurs when you do the .SaveToFile:
"Length cannot be less than zero. Parameter name: length"
So: this causes the error when you try to save the file:
dim x as string = "XYZ"
doc.Replace("[LASTNAME]", x, false, true)
This does not:
dim x as string = "XYZ"
x = x.PadRight(6)
doc.Replace("[LASTNAME]", x, false, true)
Zero length strings also do not cause the error.