View Single Post
  #1  
Old November 1st 06, 12:09 PM posted to microsoft.public.outlook.program_vba
Catalin
external usenet poster
 
Posts: 15
Default Moving sent items instead of copying them to "Sent items" folder

Dear Friends,

Please help me with this problem:
I use OL 2003 and I need to move the sent items based on the acoount through
which they are being sent. I have to mention that I have 3 accounts as well.
I have a code which is presented below but it doesn't seem to work.

Option Explicit

Public WithEvents SentItemsAdd As Items

Private Sub Application_MAPILogonComplete()
Set SentItemsAdd =
Application.GetNamespace("MAPI").GetDefaultFolder( olFolderSentMail).Items
End Sub

Private Sub SentItemsAdd_ItemAdd(ByVal Item As Object)
If Item.SenderEmailAddress = " Then
Dim oSubFolder As Outlook.MAPIFolder
Set oSubFolder =
Application.GetNamespace("MAPI").Folders.Item("wor k2006").Folders.Item("Sent
Items")
Item.Move oSubFolder
Set oSubFolder = Nothing
End If

If Item.SenderEmailAddress = " Then
Dim oSubFolder As Outlook.MAPIFolder
Set oSubFolder =
Application.GetNamespace("MAPI").Folders.Item("sal esl2006").Folders.Item("Sent Items")
Item.Move oSubFolder
Set oSubFolder = Nothing
End If

'and so on

End Sub

The event is not triggered.

Can somebody help?

Thanks in advance,
Catalin
Ads