View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JDahlgran JDahlgran is offline
external usenet poster
 
Posts: 1
Default setting address in "mail as attachment" macro

Alan;
I use a piece of code to get out batch e-mails. Although mine com
from a database, this might give you a hint.

Dim objOutlook As Outlook.Application
Dim objMailItem As Outlook.MailItem
Dim adrToAddress As String

adrToAddress = recSelectL![C_EMAIL]
Set objOutlook = New Outlook.Application
Set objMailItem = objOutlook.CreateItem(olMailItem)
With objMailItem
.To = adrToAddress 'recipient's address
.Subject = strSubject & " enter a subject." 'subject goes here
.Body = "body of message" ' message goes here
'.Attachment = "c:\path\file.txt" ' attach any files here
'Debug.Print adrToAddress
.Send
End With
End If

JDahlgra

--
Message posted from http://www.ExcelForum.com