help? (MAPI)

Helen,

First of all, this thread was perfect timing for me! I was just looking into how to convert to using MAPI instead of Outlook. I was going to ask the same question, when I came across this thread. So far I have managed to convert my VB to send Email (using the example below - thanks for that), but I am having trouble adding attachments to the mail. So I would be most grateful if you (or anyone else) could show me how I can actually add an attachment using MAPI, since as far as I can tell following example adds a “place holder” for an attachment, but does not actually specify how to add the attachment itself to the mail.

Regards,

Daniel.
Lucent Technologies.


Listserv Archives (BOB member since 2002-06-25)

Daniel,

Here is the code to attach the active document in your mail :

Set objAttach = .Attachments.Add ’ add the attachment If objAttach Is Nothing Then
Err.Raise 12, “MA MACRO”, “Unable to create new Attachment object”
Exit Sub
End If
With objAttach
.Type = CdoFileData
.Position = 0 ’ render at first character of message .Name = ActiveDocument.Name & “.rep”
.ReadFromFile ActiveDocument.FullName
End With

.Update ’ update message to save attachment in MAPI system

Christophe

From: Williams, Daniel John (Daniel) [SMTP:djw@LUCENT.COM] Sent: Monday, 14 February, 2000 12:46

Helen,

First of all, this thread was perfect timing for me! I was just looking into
how to convert to using MAPI instead of Outlook. I was going to ask the same
question, when I came across this thread. So far I have managed to convert my VB to send Email (using the example below - thanks for that), but I am having trouble adding attachments to the mail. So I would be most grateful if you (or anyone else) could show me how I can actually add an attachment using MAPI, since as far as I can tell following example adds a “place holder” for an attachment, but does not actually specify how to add the attachment itself to the mail.

Regards,

Daniel.
Lucent Technologies.


Listserv Archives (BOB member since 2002-06-25)