How to create textbox's at a userform Initialize

D

Dwaine Horton

I have a VBA program that has several forms. On one form are three
multiselect listboxes. I have a button that will allow the user to review
the data they selected and also see a final price. Seeing that I don't know
how many textboxes I will need I would like to create a text box in the
intialize procedure of the review form.

Any ideas on how I can accomplish this?
 
P

Paul C

Create the form with all of the textboxes and captions you may need.

You can then use this for the form (the code goes behind the form in VBA).

Set whatever conditions you need and show and hide boxes and captions as
needed

Private Sub UserForm_Initialize()

if (Condition to display) then
Userform.Label1.Caption = "Whatever message you need"
TextBox1.Enabled = True
TextBox1.Visible = True
else
Userform.Label1.Caption = ""
TextBox1.Enabled = False
TextBox1.Visible = False
end if
End sub
 
Top