+ Reply to Thread
Results 1 to 15 of 15

TextBox Multiline: have <br> tag between lines

Hybrid View

monak83 TextBox Multiline: have <br>... 04-19-2012, 12:37 PM
MaczaQ Re: TextBox Multiline: have... 04-19-2012, 12:39 PM
monak83 Re: TextBox Multiline: have... 04-19-2012, 12:49 PM
MaczaQ Re: TextBox Multiline: have... 04-19-2012, 01:32 PM
monak83 Re: TextBox Multiline: have... 04-19-2012, 02:16 PM
Leith Ross Re: TextBox Multiline: have... 04-19-2012, 02:08 PM
monak83 Re: TextBox Multiline: have... 04-19-2012, 02:44 PM
Leith Ross Re: TextBox Multiline: have... 04-19-2012, 02:57 PM
monak83 Re: TextBox Multiline: have... 04-19-2012, 04:15 PM
Leith Ross Re: TextBox Multiline: have... 04-19-2012, 02:47 PM
Leith Ross Re: TextBox Multiline: have... 04-19-2012, 04:26 PM
monak83 Re: TextBox Multiline: have... 04-19-2012, 04:33 PM
Leith Ross Re: TextBox Multiline: have... 04-19-2012, 08:43 PM
monak83 Re: TextBox Multiline: have... 04-20-2012, 04:58 AM
Leith Ross Re: TextBox Multiline: have... 04-20-2012, 11:26 AM
  1. #1
    Registered User
    Join Date
    04-18-2012
    Location
    Italy
    MS-Off Ver
    Excel 2007
    Posts
    9

    TextBox Multiline: have <br> tag between lines

    Hi,
    I have a userform with a TextBox multiline. Content of this textbox is inserted into a cell.
    I would have that between 1st and 2nd line there is html tag <br>.
    How can I do this?

    regards
    monak83
    Last edited by monak83; 04-20-2012 at 04:59 AM.

  2. #2
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: TextBox Multiline: have <br> tag between linees

    try to use chr(10)
    activecell.value = "one line" & chr(10) & "second line etc."
    Best Regards
    MaczaQ
    ---------------------------------------------------------------------------------------------------------------------------
    If you are satisfied with the solution(s) provided, please mark your thread as Solved
    If you are pleased with my answer consider to rate it. To thank someone who has helped you, click on the star icon below their name.
    - This way you will add him some reputation points ... thanks in advance.

  3. #3
    Registered User
    Join Date
    04-18-2012
    Location
    Italy
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: TextBox Multiline: have <br> tag between linees

    Sorry but I'm not expert VB/Excel.

    I have a textboxt where I can write in multiline (SHIFT+ENTER).
    When I go into cell (on excel page) I see my text in two line.
    I would have into cell the text in a single line with between two linees the html tag "<br>".
    How can I do?

    regards
    monak83

  4. #4
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: TextBox Multiline: have <br> tag between linees

    just attach your workbook with that textbox then I will do it for you

  5. #5
    Registered User
    Join Date
    04-18-2012
    Location
    Italy
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: TextBox Multiline: have <br> tag between linees

    Quote Originally Posted by maczaq View Post
    just attach your workbook with that textbox then I will do it for you
    In my file the TextBox is named TextBox5 with label DESCRIZIONE.

    Thanks so much for your help

    user_form_ACCESSORI.xlsm
    Last edited by monak83; 04-19-2012 at 02:39 PM.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: TextBox Multiline: have <br> tag between lines

    Hello monak83 ,

    What is the name of the Texbox?
    Which cell will the text be placed into?
    Do you want the text placed in the cell after the second line is entered?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  7. #7
    Registered User
    Join Date
    04-18-2012
    Location
    Italy
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: TextBox Multiline: have <br> tag between lines

    Quote Originally Posted by Leith Ross View Post
    Hello monak83 ,

    What is the name of the Texbox?
    Which cell will the text be placed into?
    Do you want the text placed in the cell after the second line is entered?
    textBox name: TextBox5
    cell will the text be placed: Q column

    I would that text placed into TextBox will insered in cell; if text insered is multiline I would insert into cell tag <br> between lines. Linees can be more than 2.

    thanks a lot

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: TextBox Multiline: have <br> tag between lines

    Hello monka83,

    Change the line below...
      ' From this
        Worksheets("Prodotti").Cells(iRR, 17).Value = TextBox5.Text     'Colonna Q
    
    
      ' To This
        Worksheets("Prodotti").Cells(iRR, 17).Value = Replace(TextBox5.Text, vbCrLf, "<BR>")     'Colonna Q

  9. #9
    Registered User
    Join Date
    04-18-2012
    Location
    Italy
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: TextBox Multiline: have <br> tag between lines

    Attachment 151352Thanks so much, your code works perfectly.

    Now I have add 2 CheckBox: CheckBox1 and CheckBox2 with relative TextBox14 and TextBox15.

    If I check CheckBox1 I would write into TextBox5 a string like "Capo di seconda scelta" followed by Text insered in TextBox14

    Same Thing for CheckBox15 with string "Rientro Sfilata" followed by Text insered in TextBox15.

    If I check both checkbox I would have both strings and texts.

    How Can I do?

    I attach the new file.

    Thanks so much.

    monak83
    Last edited by monak83; 04-19-2012 at 04:32 PM.

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: TextBox Multiline: have <br> tag between lines

    Hello monak83 ,

    Grazie per la spiegazione.

  11. #11
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: TextBox Multiline: have <br> tag between lines

    Hello monka83,

    There is a problem with your attachment. Please remove it and upload the file again.

  12. #12
    Registered User
    Join Date
    04-18-2012
    Location
    Italy
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: TextBox Multiline: have <br> tag between lines


  13. #13
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: TextBox Multiline: have <br> tag between lines

    Hello monak83,

    Here is the revised code for the button.
    
    Private Sub CommandButton1_Click()
    
        Dim vTemp As Variant
        Dim iRR As Long
        Dim Tesso As String
    
            ' Calcolo la riga in cui inserire i dati (la prima riga libera)
            iRR = UltimaRiga
    
            ' posso a questo punto inserire i dati
            With Worksheets("Prodotti")
                .Cells(iRR, 1).Value = "admin"
                .Cells(iRR, 2).Value = "base"
                .Cells(iRR, 3).Value = "simple"
                .Cells(iRR, 4).Value = "Abilitato"
                .Cells(iRR, 5).Value = "Catalogo, cerca"
                .Cells(iRR, 6).Value = "Accessori"
                .Cells(iRR, 8).Value = TextBox6.Text
                .Cells(iRR, 9).Value = TextBox6.Text
                .Cells(iRR, 10).Value = TextBox6.Text
                .Cells(iRR, 11).Value = TextBox7.Text
                .Cells(iRR, 25).Value = "1"
                .Cells(iRR, 27).Value = "1"
                .Cells(iRR, 28).Value = "Product Info Column"
                .Cells(iRR, 7).Value = TextBox3.Text    ' Colonna 1 (A)
                .Cells(iRR, 12).Value = TextBox4.Text   ' Colonna 2 (B)
                .Cells(iRR, 13).Value = ComboBox1.Text
                .Cells(iRR, 14).Value = ComboBox7.Text
                .Cells(iRR, 15).Value = ComboBox8.Text
                .Cells(iRR, 16).Value = ComboBox9.Text
            
                Tesso = "Suola interna in cm:" + _
                    TextBox11.Text _
                    + " " + "-" + " " + "Tacco:" + TextBox12.Text _
                    + " " + "-" + " " + "Plateaux:" + TextBox13.Text _
                    + "<BR>"
                If CheckBox1.Value = True Then
                    Tesso = Tesso & CheckBox1.Caption & ": " & TextBox14.Text & "<BR>"
                End If
            
                If CheckBox2.Value = True Then
                    Tesso = Tesso & CheckBox2.Caption & ": " & TextBox15.Text & "<BR>"
                End If
            
                .Cells(iRR, 17).Value = Tesso & Replace(TextBox5.Text, vbCrLf, "<BR>")
                .Cells(iRR, 18).Value = ComboBox10.Text
                .Cells(iRR, 19).Value = ComboBox2.Text
                .Cells(iRR, 20).Value = ComboBox3.Text
                .Cells(iRR, 21).Value = ComboBox4.Text
                .Cells(iRR, 22).Value = ComboBox5.Text
                .Cells(iRR, 23).Value = ComboBox6.Text
                .Cells(iRR, 24).Value = TextBox9.Text
                .Cells(iRR, 26).Value = TextBox10.Text
            End With
    
      
          ' dato che non esiste nessun controllo la doppi pressione sul bottone
          ' provoca due inserimenti per evitare chiudo e scarico il Form
            Unload Me
            UserForm1.Show
            
    End Sub

  14. #14
    Registered User
    Join Date
    04-18-2012
    Location
    Italy
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: TextBox Multiline: have <br> tag between lines

    Thanks so much!!!

  15. #15
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: TextBox Multiline: have <br> tag between lines

    Hello monak83,

    Siete benvenuto. Che cosa è il significato di "Rientro Sfilata"?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1