I susspect the problem is one i have come accross many of time useing ;
InStr([start, ]string1, string2[, compare])
and
Replace(expression, find, replace[, start[, count[, compare]]])
Its simple and easy to fix, although the compare property is optional it isnt, this causes your crash...