Function StrWhile(tcStr, tcRepl, tcReplWith) Do While Atc(tcRepl, tcStr)>0 And tcRepl#tcReplWith tcStr2=Strtran(tcStr, tcRepl, tcReplWith) If tcStr2==tcStr Exit Else tcStr=tcStr2 Endif Enddo Return tcStrThe reason I have this if/else block is that it sometimes doesn't replace the string. I've set the watch on the atc() expression, and it remains unchanged, somewhere about 200K or more.