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

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

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,118,807
Messages
5,574,425
Members
412,591
Latest member
dawnkotzebue
Top