sending a item and keep track of that item

D

donald

hi there,

i trying to run the code below but when i send the e-mail it doesn't
keep track of the item so when i try and create a Journal and attach it
to it, it doesn;t work it said the item as been delete or move which is
right? how can i keep track of it to add it to the Journal??

thanks

Jonathan


Dim myItem As outlook.MailItem

myItem =
_Application.CreateItem(outlook.OlItemType.olMailItem)
Dim myAttachments As outlook.Attachments =
myItem.Attachments
With myAttachments
.Add(letter, 1, 1, "Enquiry Letter")
.Add(IDDDoc, 1, 1, "Initial Disclosure Document")
.Add(FFDoc, 1, 2, "Mortgage Fact Find")
.Add(DPNDoc, 1, 3, "Data Protection")
.Add(TNDoc, 1, 4, "Terminology Notice")
End With

With myItem.Links
For i As Integer = 1 To mcase.Links.Count
myItem.Links.Add(mcase.Links(i).Item)
Next
End With
InputBox(myItem.EntryID, "myItem", myItem.EntryID)
With myItem
.SentOnBehalfOfName = "Malbridge MS"
.To = "(e-mail address removed)"
'mcase.Links(1).Item.Email1Address
.SaveSentMessageFolder =
_NameSpace.Folders.Item("MailBox - Malbridge MS").Folders("Sent Items")
.Subject = "Appointments for "
.Body = "Dear " +
mcase.Links(1).Item.UserProperties.Find("Salutation").Value + Chr(10) +
Chr(10) + _
"Please see attach Document" + Chr(10) + Chr(10) +
_
mcase.Links(1).Item.ManagerName
.Send()
End With

With mJournal

.Subject = "Sent ENQ for " & mcase.Subject

.Type = mcase.Subject

'.Body =
.Save()

For i As Integer = 1 To mcase.Links.Count
.Links.Add(mcase.Links.Item(i).Item())
Next

.Save()

.Attachments.Add(myItem,
Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, , "ENQ
letter")


..Close(Microsoft.Office.Interop.Outlook.OlInspectorClose.olSave)

End With
 
S

Sue Mosher [MVP-Outlook]

As soon as you send the item, it's no longer available to other operations. (That's why you're getting the warning message.) For your journaling, you may want to use an event handler that monitors the Sent Items folder for new items.


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top