How to feed a userform a variable to display in a textbox?

C

Chet

I am trying to feed or supply a userform text box a variable which I
have assigned in my main code module. I am having a problem getting
the variable data to display in the userform when I show the user
form. A blank userform text box shows up instead. I'm doing
something wrong. Here is what I did.

1. Created the variable FormTextToShow in my main code module and
named it as a Public variable.

FormTextToShow = "Program will run for location " & Location & " for
month of " & MonthAlpha & " " & TargetYear


2. I have the following code in my "form module". Textbox3 is the
variable that should be feeding the textbox.

Private Sub CommandButton1_Click()
TextBox3.Value = FormTextToShow
TextString1 = TextBox3.Text
PrelimStatus = OptionButton1.Value
FinalStatus = OptionButton2.Value
MinMinutesToKeep = TextBox2.Text
FilterOut = CheckBox1.Value
SaveToDesktop2 = OptionButton3.Value
SaveToMyDocs2 = OptionButton7.Value
SaveToFltSched = OptionButton8.Value
SaveToGeneral = OptionButton4.Value
SaveNo = OptionButton6.Value
Unload FltSchedAnalysis
End Sub


Possibly i am doing it in the wrong sequence or section of code.
Where should I put the code you mentioned?

The problem is when I run the main code and the variable
FormTextToShow does not show up. I just get a blank
textbox showing up on my form. (I did do a step-through it test and
ran the code and the FormTextToShow variable did show up then in my
textbox3.) My idea is to show the user what data the program will be
running in the userform so I'm actually "feeding" the user form.

What am I doing wrong? Thx much... Chet
 
C

Chet

Try moving the code to the UserForm initialize event.....

--

Regards,
Nigel
(e-mail address removed)













- Show quoted text -

That did the trick!.. Thank you .. . Chet
 

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