I Modified Rons Code a bit to be Table driven. Add Recipents in Column "A"
Subject in Column "B" And Body in Column "C". It will loop through Column
"A" And send to each Recipent.
Sub MailItem()
Dim Outlook As Object
Dim Mail As Object
Dim Body As String
Dim i As Long
Dim LastRow As Long
Dim ws As Worksheet
Set ws = ActiveWorkbook.Worksheets(1)
LastRow = ws.Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To LastRow
Set Outlook = CreateObject("Outlook.Application")
Outlook.Session.Logon
Set Mail = Outlook.CreateItem(0)
Body = ws.Range("C" & i).Value
On Error Resume Next
With Mail
.To = ws.Range("A" & i).Value
.Subject = ws.Range("B" & i).Value
.Body = Body
.send
End With
Next
On Error GoTo Morgue
ErrorOut:
Set Outlook = Nothing
Set Mail = Nothing
Exit Sub
Morgue:
MsgBox Err.Description, vbCritical
Resume ErrorOut
End Sub
Good Luck!
"Ron de Bruin" wrote:
Start with this example
http://www.rondebruin.nl/mail/folder3/smallmessage.htm
Read also the tips page (link is on the page)
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
wrote in message ...
On Dec 1, 8:12 am, Office_Novice
wrote:
Search excels Help file for Routing slip.
" wrote:
Hi,
I want to send an email in excel programmatically but I don't want to
send a workbook or worksheet. I also need to be able to specify the
subject, recipients, and message.
I'm looking for something similar to the 'docmd.sendobject' method in
an access database. Is there anything like that?
yeah I found routing slip. It sends the workbook. That isn't what I
want to do. I do not want to send an object to the recipient - just a
message, and I don't want the recipient to route it to anyone else. I
am going to send out passwords for a database application. I figured
it would be easier to reference and move from cell to cell including
the cell values in the message text because I don't know how to access
and move from record to record in a database table.