How to create a dynamic Userform via VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'd like to create a dynamic userform which can vary the number of inputs depending on the user. A userform will be displayed with 1 textbox to enter their car model. There will be a command button that will allow the user to 'add' more textboxes if they have more cars. Of course I will be placing a limit on the number of cars a person can enter! =)

So my first question would be: is there code which will allow me to resize the userform (eg widen by x lines/pixels/whatever) as the user adds textboxes?

My second question is: is there a relatively simple piece of code which will allow me to add a textbox, say, directly below the one above (maybe with some space in between)?

Thanks very much.
 
Userform has height and width properties.

Look in help at controls.Add

the bottom of the first textbox

sepval = 10
Textbox2.Top = Textbox1.Top + textbox1.Height + sepval

--
Regards,
Tom Ogilvy


SuperJas said:
Hi,

I'd like to create a dynamic userform which can vary the number of inputs
depending on the user. A userform will be displayed with 1 textbox to enter
their car model. There will be a command button that will allow the user to
'add' more textboxes if they have more cars. Of course I will be placing a
limit on the number of cars a person can enter! =)
So my first question would be: is there code which will allow me to resize
the userform (eg widen by x lines/pixels/whatever) as the user adds
textboxes?
My second question is: is there a relatively simple piece of code which
will allow me to add a textbox, say, directly below the one above (maybe
with some space in between)?
 
Back
Top