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

When I try to substitute your code for my existing line (substituting an
email address for the "reSelectL![C_EMAIL]" text), I get a "user-defined
type not defined error on the "Dim objOutlook As Outlook.Application" line.
I'm a VB newbie, so I don't have a clue what this is telling me. Any help?

Alan D.


"JDahlgran " wrote in message
...
Alan;
I use a piece of code to get out batch e-mails. Although mine come
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

JDahlgran


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