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.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

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:
 

Forum statistics

Threads
1,172,032
Messages
5,878,823
Members
433,373
Latest member
strichpunkt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top