How can I make a Scrollbar load ONLY when it's needed?

Hey guys,

I have checked out Kirupa’s great tutorial on this, but that was based on an input box and then a “result box”.

I would just like to make a simple dynamic text boxt that loads a scrollbar automatically when it is needed , and NOT show when it is not needed.
Could anyone please point me towards any simple code for that?

Thanks in advance.