View Single Post
 
Old 01-08-2013, 04:41 PM
Claytocb Claytocb is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Sep 2012
Posts: 5
Claytocb is on a distinguished road
Default Format email body-Using Excel VBA to send mail

Hello

I am relatively new to VBA and just trying to learn some things to help automate some processes. I have the below VBA code attached to a command button to send an email from excel with an attachment.
The code works great but is there a way to format the text in the email body and/or include any type of logo or signature in the body?

Thanks!
Code:
Private Sub Button1_Click() 
    sendemail 
End Sub 
 
Public Function sendemail() 
    esubject = "Daily Report" 
    sendto = "brad2343@gmail.com" 
    ebody = Range("A7") & vbCrLf & Range("A8") & vbCrLf & Range("A9") & vbCrLf & Range("A10") 
    newfilename = "C:\user\docs\Letter.doc" 
     
    Set app = CreateObject("Outlook.Application") 
    Set itm = app.createitem(0) 
     
    With itm 
         
        .Subject = esubject 
        .to = sendto 
        .body = ebody 
        .attachments.Add (newfilename) 
        .Display 
        .send 
    End With 
     
    Set app = Nothing 
    Set itm = Nothing 
     
End Function

Last edited by macropod; 01-31-2013 at 11:36 PM. Reason: Added code tags & formatting
Reply With Quote