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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top