Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding text to textbox with excisting text

Status
Not open for further replies.

InDenial

Technical User
Aug 1, 2003
191
NL
Hi everyone,

This deals with a userform in excel.

I need to write some lines to a textbox. based on what checkboxes are checked and what info is inserted in other textboxes it might happen dat sometimes a line does not have to be put in the textbox.

Right now I gather all the variables and put then in the textbox as follows:

TxtData.text = "line one " & var1 & char(13) _
"line two " & var2 & char(13) _
"line three " & var3 & char(13)

that goes fine... but sometimes I do not want line two to be printed to the text box.

So I want to know if it is possible to:

print line one to the textbox
decide if line two needs to be printed if so.. print it if not don't print it.
then print line 3

It must be possible to copy and paste all the lines.

thanks in advance for the time....

InDenial

 
myString = "line one" & vbCRLF
If myCondition = True Then
myString = myString & "line two" & vbCRLF
End If
myString = myString & "line three"
txtData.Text = myString

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
Wow that was a quicky...:)

Thanks for the response...

Hmmm your answer is what I was afraid of. This means rewriting the script...

thanks for the asnwer....

InDenial

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top