Version 3.01.05.
In TEncodeFormula.ValueError, for ERR_EMPTY_FORMULA, the FTokenizer still holds the last formula encoded. The current, empty one, hasn't reached the tokenizer yet. Consequently, the following line will produce a misleading error message:
ErrStr := Format('Error in formula %s' + #13,[FTokenizer.Value]) + ErrStr;
It will say something like:
Error in formula $A$10+$B$10
Empty formula
Rather confusing, since "$A$10+$B$10" is NOT empty.
I think you need either to clear the FTokenizer state so that FTokenizer.Value is empty at this point, or write code for a special case for ERR_EMPTY_FORMULA, so that FTokenizer.Value isn't inserted into the error message.
By the way, you can write 'Error in formula %s'#13 without the + before #13.
Kjell