Sendmail funtction

Tyler

New Member
Joined
Sep 19, 2006
Messages
5
Does anyone know how to add body text using the sendmail function.
The following is code i currently have:

Sub sendmyworkbook()

ActiveWorkbook.sendmail Recipients:="dispatch@taklogistics.com", Subject:="Driver Detention Warning"

End Sub

Also is it possible to send an email from excel without attaching the workbook? Any code for this would be helpful.
 

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Example:

Code:
Sub Email_It()
Dim objOutlk As Outlook.Application
Dim objOutlkMsg As Outlook.MailItem
Dim objOutlkRecip As Outlook.Recipient
Dim Subject, Msgbody As String
Dim cel As Range, sto As String
Subject = "Your subject line goes here"
Msgbody = "Dear All" _
& vbCrLf & vbCrLf & "Your message goes here" _
& vbCrLf & vbCrLf & vbCrLf & "Regards," _
& vbCrLf & "Carmella"
Set objOutlk = CreateObject("Outlook.Application")
Set objOutlkMsg = objOutlk.CreateItem(olMailItem)
    With objOutlkMsg
    For Each cel In Selection
        sto = cel.Value
        Set objOutlkRecip = .Recipients.Add(sto)
        objOutlkRecip.Type = olTo
    Next cel
    .Subject = Subject
    .Body = Msgbody
    .Save
    .Send
End With
Set objOutlk = Nothing
End Sub

Apologies if your name is not Carmella :LOL:
 

Watch MrExcel Video

Forum statistics

Threads
1,112,885
Messages
5,543,028
Members
410,583
Latest member
gazz57
Top