MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Visual Basic Text Box

Posted by Ampleford on September 10, 2001 8:04 AM

How do I get the text on a VB Text box to drop down a line ? For example to look like this :-

Please Key Week Number
(Week number will default to this week automatically)

And can I get it to recognise "this week" and put that number (from a lookup) onto the text box with the writing. The spread does the work - I just want to tell the user.

Posted by Damon Ostrander on September 10, 2001 2:04 PM

Hi Ampleford,

I would recommend that you do not write the prompt into the cell, where the user can conceivably edit it, delete it, or append the week number to the end of it, and you would have to write code to handle all these possibilities. Why not instead put a label (can have a white background if you want to make it look just like a textbox or part of the other textbox) right above it with this text in it? The text can be written to a label under VBA control just as it is to a textbox, but the advantage of a label is that it can't receive focus so the user can never type into it.