Blank Lines in Email Body


Board Regular
Oct 13, 2016
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:

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("")
        .To = emailcontact
        .CC = ""
        .BCC = ""
        .Subject = emailsubject
        .htmlbody = "[COLOR=&quot][FONT=&quot]" & emailbody & .htmlbody
    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.


Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...