FindAndHighlight.2010.sln

I used VS2012 pro to open and run the FindAndHighlight.2010.sln

at line 97 [afterRun.Text = run.Text.Substring(position);], I get this

System.ArgumentOutOfRangeException was unhandled
Message=startIndex cannot be larger than length of string.

Hi William,

Thanks for your inquiry. I suggest you please use the true value for isForward parameter in Range.Replace Method (Regex, IReplacingCallback, Boolean). Hope this helps you.

If you still face problem, please share your input document and the call of Range.Replace method.I will investigate the issue on my side and provide you more information.