html email margins

Chas17

Well-known Member
Joined
Oct 16, 2002
Messages
657
Daniel Klann gave me some code to place an excel range into outlook email

Dim oOutlookApp As Object, oOutlookMessage As Object
Dim rngeSend As Range, strHTMLBody As String
Dim lngRow As Long, lngCol As Long

oOutlookMessage.htmlbody = Range("CERemarks")

If the text in Range("CERemarks") is long it just goes off the page in the email, i.e. it does not wrap text. How do I set it to wrap the text or set margins in the email?

Thanks
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
HTML break row is < br > (with no spacies) it works like Chr(10) in VB, so if you input < br > into your text it will "break" there

HTH
 
Upvote 0
Thanks, I knew about
. I have a single Cell with 200 char. when I try to put that cell into the body of the email, it does not wrap the text, the email shows a single long line.

thamks,
Chas
 
Upvote 0
if you have your 200 char in A1 you can try:

.HTMLBody = Left(Cells(1, 1), 80) & "< br >" & Mid(Cells(1, 1), 81, 80) & "< br >" & Mid(Cells(1, 1), 161, 40)

but this will break some words in the middle
if you want to avoid that I would use Replace () function to find first space after 80th character and replace it with "< br >" end than the same for 160th character....

HTH
 
Upvote 0

Forum statistics

Threads
1,221,618
Messages
6,160,853
Members
451,674
Latest member
TJPsmt

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