Blank Lines in Email Body

Ruca13

Board Regular
Joined
Oct 13, 2016
Messages
85
Hello all,

I have a code to generate a outlook email based on cells.

I can generate the email fine but for some reason I have two blank lines between the email body text and my signature.

Another slight problem is the font size. When I define to 11, it shows as 10. I tried to change to 12 and to 10, and in both situations it is okay, the only problem seems to be when the font size is 11.

Here is the code:

Code:
Option Explicit


Sub tailwinsemail()


    Application.ScreenUpdating = False
    'Application.Calculation = xlCalculationManual
    Application.EnableEvents = False
    Application.DisplayAlerts = False
    
    Dim emailsheet As Worksheet
    Dim tailwinslist As Worksheet
    Dim reference As Variant
    Dim emailref As Variant
    Dim emailcontact As Variant
    Dim emailsubject As Variant
    Dim emailbody As Variant
    Dim OutApp As Object
    Dim OutMail As Object
    Dim mailfontname As String
    Dim mailfontsize As String
    Dim mailfontcolor As String
    
    Set emailsheet = ThisWorkbook.Worksheets("Tailwins Email")
    Set tailwinslist = ThisWorkbook.Worksheets("Tailwins List")
    
    Set reference = Cells(ActiveCell.Row, 2)
    
    mailfontname = emailsheet.Cells(11, 7)
    mailfontsize = emailsheet.Cells(12, 7)
    mailfontcolor = emailsheet.Cells(13, 7)
    
    emailsheet.Cells(2, 7) = "'" & reference.Value
    
    Set emailref = emailsheet.Cells(2, 7)
    
    emailcontact = emailsheet.Cells(1, 3)
    emailsubject = emailsheet.Cells(3, 3)
    emailbody = emailsheet.Cells(5, 3) & "
" & "
" & emailsheet.Cells(6, 3) & "
" & "
" & _
    emailsheet.Cells(7, 3)
    
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)


    With OutMail
    Set .SendUsingAccount = OutApp.Session.Accounts.Item("helpdesk@essentialjetsolutions.com")
        .Display
        .To = emailcontact
        .CC = ""
        .BCC = ""
        .Subject = emailsubject
        .htmlbody = "[COLOR=&quot][FONT=&quot]" & emailbody & .htmlbody
        .Display
    End With


    Set OutMail = Nothing
    Set OutApp = Nothing
    
    Application.ScreenUpdating = True
    'Application.Calculation = xlCalculationAutomatic
    Application.EnableEvents = True
    Application.DisplayAlerts = True


End Sub

Thank you for your help.

Regards,
Rui[/FONT][/COLOR]
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,224,818
Messages
6,181,152
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