Click to See Complete Forum and Search --> : "Throw" an attachment at Outlook and have it display it's new email form


Jim F
08-28-2002, 04:17 PM
Folks,
I would like to be able to invoke Outlook with an attachment and have it bring up the new mail message dialog with the attachment so the user can then finish filling out the email with the rest of the info. I would like to do in code the same capability as when I right-click on a file and select the "Send To -> Mail Recipient". I've seen the solutions for sending mail using the Outlook object model, but none that just throws a file at Outlook and then let's Outlook do it's thing. Any help?

Regards,

Jim F.

Jim F
08-28-2002, 04:56 PM
Folks,
A little more digging in the technical references uncovered the simple answer. Here's a VB sample that does what I need.

Jim F.

---------------------------
Dim myItem As MailItem
Dim oOutLookApp As Outlook.Application
Dim myAttachments As Attachments
Dim myAttachment As Attachment

Set oOutLookApp = New Outlook.Application
Set myItem = oOutLookApp.CreateItem(olMailItem)
Set myAttachments = myItem.Attachments
Set myAttachment = myAttachments.Add("c: empDmsDocDetails.txt", olByValue, 1, "The Doc Name")
myItem.Display


------------
Jim F at 8/28/2002 5:17:55 PM

Folks,
I would like to be able to invoke Outlook with an attachment and have it bring up the new mail message dialog with the attachment so the user can then finish filling out the email with the rest of the info. I would like to do in code the same capability as when I right-click on a file and select the "Send To -> Mail Recipient". I've seen the solutions for sending mail using the Outlook object model, but none that just throws a file at Outlook and then let's Outlook do it's thing. Any help?

Regards,

Jim F.