Pipe2Path
Programmer
- Aug 28, 2001
- 60
I am trying to use CDO to email an excel document as an attachment. I retrieve the attachment from an email and am trying to forward it to someone else. I am able to retrieve the attachment from the original email, but when I go to send it out again, the excel file cannot be opened. It attaches it as a text file.
Here is my code :
Set objMessage = objICEEMail.Outbox.Messages.Add
'create message
objMessage.Subject = "Invoices"
'create attachment
Set objAttach = objMessage.Attachments.Add(objAttachment)
With objAttach
.Type = CdoFileData
.Position = 0 ' render at first character of message
End With
objMessage.Update
'create recipient
Set objRecipient = objMessage.Recipients.Add
'add recipients name
strRecipient = 'John Doe'
objRecipient.Name = Replace(strRecipient, "'", "")
objRecipient.Type = mapiTo
objRecipient.Resolve
objMessage.Update
'send message
objMessage.Send ShowDialog:=False
Thanks in advance.
Here is my code :
Set objMessage = objICEEMail.Outbox.Messages.Add
'create message
objMessage.Subject = "Invoices"
'create attachment
Set objAttach = objMessage.Attachments.Add(objAttachment)
With objAttach
.Type = CdoFileData
.Position = 0 ' render at first character of message
End With
objMessage.Update
'create recipient
Set objRecipient = objMessage.Recipients.Add
'add recipients name
strRecipient = 'John Doe'
objRecipient.Name = Replace(strRecipient, "'", "")
objRecipient.Type = mapiTo
objRecipient.Resolve
objMessage.Update
'send message
objMessage.Send ShowDialog:=False
Thanks in advance.