Thanks Sue...
But I'm stuck..here's what I have close but doesn't work..any more help??
Sub Send_Attachment_Messages()
Dim oFolder As Outlook.MAPIFolder
Dim Items As Outlook.Items
Dim objItem As MailItem
Dim Recips As Recipients
Dim Recip As Recipient
Set Items =
Application.GetNamespace("MAPI").GetDefaultFolder( olFolderOutbox).Items
Set objItem = Items.Item(1)
Set Recips = objItem.Recipients
For Each Recip In Recips
If Recip.Address = " Then
objItem.Attachments.Add ("C:\copper\115.xls")
objItem.Send
ElseIf Recip.Address = " Then
objItem.Attachments.Add ("C:\copper\116.xls")
objItem.Send
End If
Next
End Sub
I really appreciate your help
Joel
"Sue Mosher [MVP-Outlook]" wrote:
To returns only display names/addresses. You should instead iterate the objItem.Recipients collection and check each Recipient.Address and Recipient.Type.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
"Joel" wrote in message ...
TIA:
I have the following code to attach a file to email.
Sub Add_Attachment_To_Messages()
Dim oFolder As Outlook.MAPIFolder
Dim items As Outlook.items
Dim objItem As MailItem
Set items = Application.GetNamespace("MAPI").GetDefaultFolder
_(olFolderOutbox).items
For Each objItem In items
If objItem.To = '" Then
objItem.Attachments.Add ("\\copper\115.xls")
objItem.Send
End If
Next
End Sub
The email is opened but no attachement. In the code I have tried the actual
email address and the Display As address and neither work??? Outlook is in
a network with Exchange Server that Creates Dispay As info such as Bob Smith
(ND) where the email is
I tried the code on my computer at home and it works fine.
Any ideas as to the problem/solution are much appreciated.
Joel