Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email Attachment not visiable

Status
Not open for further replies.

grannyM

Programmer
Nov 26, 2002
39
0
0
US
I have some code that we use all the time to send an email from Word. Usually I just put the text in the body of the email, or if they need to reference a file, I put a link in the body of the email. However, this email is going out-of-house and needs an attachment. The problem is it seems the attachment isn't added until the email is sent. If I use the display feature, the attachment doesn't show in the draft email. But if I send the email to myself, it does show up in both the email I receive and in the one in my Sent folder. Does anyone have any suggestions on how to have the attachment displayed in the draft email?

Code:
Dim SafeItem, oItem, ccRecipient As Object
Dim olapp As Outlook.Application
Dim nspnamespace As Outlook.NameSpace

Set olapp = Outlook.Application
Set nspnamespace = olapp.GetNamespace("Mapi")
Set SafeItem = CreateObject("cpioutlook.SafeMailItem")
Set oItem = olapp.CreateItem(0)

SafeItem.Item = oItem
SafeItem.Recipients.Add clientemail$
SafeItem.Recipients.ResolveAll
SafeItem.CC = Emailcc$
SafeItem.Subject = EmailSubject1$
SafeItem.body = body$

SafeItem.Attachments.Add savename$, olByValue, 22, EmailSubject$

SafeItem.Display

Set olapp = Nothing
Set nspnamespace = Nothing
Set SafeItem = Nothing
Set oItem = Nothing
 
GrannyM

If you add safeitem.save it will save a proper copy in your outbox with the attachemnt etc ready to send.
 
Thanks. I added SafeItem.Save right after the SafeItem.Attachements line. and you are correct, it does show up in my Draft folder with the attachment. However, the email that's displayed on the taskbar by the SafeItem.Display command does not show the attachment. Is there anyway to have the attachment show in that displayed email?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top