L
lau.freddy
Hy together,
im getting really mad with VBA in Outlook 2003.
Im trying to check when a mail has been send from which account it was
send. After that I want to move the sent mail in a special folder if
the sender is ....
Im trying it with this code....
Option Explicit
Public WithEvents SentItems As Outlook.Items
Private Sub Application_Startup()
Set SentItems = _
Outlook.Session.GetDefaultFolder(olFolderSentMail).Items
End Sub
Private Sub Application_Quit()
Set SentItems = Nothing
End Sub
Private Sub SentItems_ItemAdd(ByVal Item As Object)
Select Case Item.From
Case "(e-mail address removed)" ' folder1
Item.Move
Outlook.Session.GetDefaultFolders(olFolderInbox).Folders("TEST")
Case "(e-mail address removed)" ' folder2
Item.Move
Outlook.Session.GetDefaultFolders(olFolderInbox).Folders("TEST2")
Case Else ' Leave it in the top Inbox
Item.Move Outlook.Session.GetDefaultFolders(olFolderInbox)
End Select
End Sub
Can someone help me please!!! Thanks really for any suggestion....
im getting really mad with VBA in Outlook 2003.
Im trying to check when a mail has been send from which account it was
send. After that I want to move the sent mail in a special folder if
the sender is ....
Im trying it with this code....
Option Explicit
Public WithEvents SentItems As Outlook.Items
Private Sub Application_Startup()
Set SentItems = _
Outlook.Session.GetDefaultFolder(olFolderSentMail).Items
End Sub
Private Sub Application_Quit()
Set SentItems = Nothing
End Sub
Private Sub SentItems_ItemAdd(ByVal Item As Object)
Select Case Item.From
Case "(e-mail address removed)" ' folder1
Item.Move
Outlook.Session.GetDefaultFolders(olFolderInbox).Folders("TEST")
Case "(e-mail address removed)" ' folder2
Item.Move
Outlook.Session.GetDefaultFolders(olFolderInbox).Folders("TEST2")
Case Else ' Leave it in the top Inbox
Item.Move Outlook.Session.GetDefaultFolders(olFolderInbox)
End Select
End Sub
Can someone help me please!!! Thanks really for any suggestion....