Excel: Formatting an email in VBA‏


I have the following code which creates an email after selecting cells in Excel. The Email defaults to Font Calibri 12. If I want to make B17 bold and B28 in Calibiri 8, how do I incorporate within the code? Many thanks, ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sub Create_Individual_Email() 'Sending email to individual partners Dim OutApp As Object Dim OutMail As Object Dim strbody As String Sheets("Message").Visible = True Sheets("Message").Select Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = "" & Range("B2").Value & "" .Subject = "" & Range("b4").Value & vbNewLine .Body = "" & Range("b6").Value & vbNewLine & _ "" & vbNewLine & _ "" & Range("b8").Value & vbNewLine & _ "" & Range("b10").Value & vbNewLine & _ "" & vbNewLine & _ "" & Range("b12").Value & vbNewLine & _ "" & vbNewLine & _ "" & vbNewLine & _ "" & Range("b14").Value & vbNewLine & _ "" & Range("b15").Value & vbNewLine & _ "" & vbNewLine & _ "" & vbNewLine & _ "" & Range("b17").Value & "," & vbNewLine & _ "" & Range("b18").Value & "," & vbNewLine & _ "" & Range("B19").Value & vbNewLine & _ "" & Range("B20").Value & vbNewLine & _ "" & Range("B21").Value & vbNewLine & _ "" & Range("B22").Value & vbNewLine & _ "" & Range("B23").Value & vbNewLine & _ "" & Range("B24").Value & vbNewLine & _ "" & Range("B25").Value & vbNewLine & _ "" & Range("B26").Value & vbNewLine & _ "" & vbNewLine & _ "" & Range("B28").Value & vbNewLine 'You can add a file like this .Attachments.Add "" & Range("b30").Value & "" .Attachments.Add "" & Range("b31").Value & "" '.Send 'or use .Display .Display End With On Error GoTo 0 Sheets("Message").Visible = False Set OutMail = Nothing Set OutApp = Nothing End Sub


This question generated 22 answers. To proceed to the answers, click here.

This thread is current as of July 11, 2014.


For more resources for Microsoft Excel