Set the WordWrap property of the memo to true, dump your text into it, count the lines, and set the height to the product of the line count and the line height. But you need to know the line height.
The tMemo object does not expose a line height property, but if you're not changing the font or font size at runtime, you can determine the line height experimentally at design time.
Here's the code I used to set the height of a memo that had a line height of 13 pixels. I also found that I needed a small constant to account for the memo's top and bottom borders. I limited the height to 30 lines (396 pixels) to keep it on the form.
// Memo.WordWrap = true (at design time)
Memo.Text := <ANY AMOUNT OF TEXT>;
Memo.Height := min(19+Memo.Lines.Count*13,396);
If you absolutely must extract the line height from the object at run time, then you must use 'Someone's answer. Or, you can use a tRichEdit object, which has a SelAttributes property containing a Height property giving the line height.
-Al.