how to wrap text

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,259
Office Version
  1. 2010
Platform
  1. Windows
hi all,good morning. I hope you can help me please? I have the code, where it copies from spreadsheet and pastes into an email, but I would like to have a wrap text for when its transferred into the email, can you help please?


HTML:
 With Sheets("Handover")
        Set rngDataToEmail = .Range("H4:R" & .Range("H" & Rows.Count).End(xlUp).Row)
    End With

this is the whole code

HTML:
Private Sub CommandButton4_Click()
Dim aOutlook As Object
Dim aEmail As Object
Dim rngeAddresses As Range, rngeCell As Range, strRecipients As String
Dim rngDataToEmail As Range

    Set aOutlook = CreateObject("Outlook.Application")
    Set aEmail = aOutlook.CreateItem(0)
    With Sheets("Handover")
        Set rngDataToEmail = .Range("H4:R" & .Range("H" & Rows.Count).End(xlUp).Row)
    End With
    
    aEmail.HTMLBody = "<html>" & _
                    "<p>Hi Paul/Jayne, good afternoon, <p>In day today there was an additional " & Worksheets("Handover").Range("F6").Value & " jobs raised in the system by myself to try and fill the guys up- escalations/sites brought forward. (This does not include the raising of duplicate jobs where work was raised incorrectly or needed to be re-raised due to technical fault)." & Worksheets("Handover").Range("F8").Value & "</p>" & _
                    "<p><u><b>" & Me.TextBox4.Value & "</p></u></b>" & _
                    "<table border=""1"", cellpadding=""18"", style=background:""#a6bbde"" >" & _
                "<tr>" & _
                    "<th>NCMO Issue:</th>" & "<td>" & Worksheets("Handover").Range("C5").Value & "</td>" & "<th>Re-Raised:</th>" & "<td>" & Worksheets("Handover").Range("F5").Value & "</td>" & _
                    "</tr>" & _
                "<tr>" & _
                    "<th>SNR:</th>" & "<td>" & Worksheets("Handover").Range("C6").Value & "</td>" & "<th>Additional Jobs:</th>" & "<td>" & Worksheets("Handover").Range("F6").Value & "</td>" & _
                    "</tr>" & _
                "<tr>" & _
                    "<th>Replans:</th>" & _
                    "<td>" & Worksheets("Handover").Range("C7").Value & "</td>" & "<th>Rebinds:</th>" & "<td>" & Worksheets("Handover").Range("F7").Value & "</td>" & "<th>Outages:</th>" & "<td>" & Worksheets("Handover").Range("c8").Value & "</td>" & _
                    "</tr>" & _
                    "</table>" & _
                "" & _
                "<p><u><b>" & Me.TextBox5.Value & "</p></u></b>" & _
                "<p>" & Me.TextBox1.Value & "</p>" & _
                "<p><u><b>" & Me.TextBox6.Value & "</p></u></b>" & _
                "<p>" & Me.TextBox2.Value & "</p>" & _
                "<p><u><b>" & Me.TextBox7.Value & "</p></u></b>" & _
                "<p>" & Me.TextBox3.Value & "</p>" & RangetoHTML(rngDataToEmail) & _
                "<p>Many Thanks</p>" & _
                "<p>New Connections Team</p>" & _
                "</body></html>"
    
    
    aEmail.Recipients.Add (Worksheets("Email Links").Range("B2").Value)
    aEmail.CC = (Worksheets("Email Links").Range("C2").Value)
    aEmail.BCC = ""
    aEmail.Subject = "" & Range("C1").Value & " " & Range("K1").Value
    aEmail.Display
    
       
End Sub
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi believe I need to put this code in somewhere
Code:
.WrapText = True
but I don't know whereto add it or if anything else needs to g with it. hope you can help
 
Upvote 0
Hello,

It seems to me you are talking about your HTMLBody ...

If it is case ... you will have to use

< br > < br > ...(without spaces) ...

Hope this help
 
Upvote 0
hello, sorry I am not following will <BR> wrap text? or do I put the wrap text inbetween?
 
Upvote 0
Hello,

Within your section aEmail.HTMLBody = "" & _

HTH
 
Upvote 0
sorry what do I need to put in is it like this? I am new to this still.
HTML:
aEmail.HTMLBody = "<BR>wraptext=True<bR>" & _
 
Upvote 0
You have to go through a trial and error process ...

Inserting < br > < br > ...(without spaces) ...

each and every time you feel to make your text ... breathe ...:wink:
 
Upvote 0
hi I just changed it to.... but it didn't work :(<wraptext=true> <br><wraptext=true><br>
HTML:
aEmail.HTMLBody = "<wraptext=true>" & _HTML]</wraptext=true></wraptext=true>
 
Last edited:
Upvote 0
wraptext=true
<wraptext=true>
I put this inbetween the ""</wraptext=true>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top