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

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

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:
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,117
Messages
5,857,482
Members
431,882
Latest member
saaaaaaaaaaaaaaaaaaaaaa

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