B
BlueWolverine
Hello,
MS OUTLOOK 2003 on XP PRO.
What I'm trying to do:
I want to take every email I send, move it to a PST folder, and mark as read
using VBA since this isn't possible in a rule (specifically mark as read).
My Problem:
Through this forum and some other places, I think I have code that's at
least close to doing this. The problem is, the darn thing never triggers.
Please help me with this code. Thank you.
All of what follows is the entirety of a class module.
Dim myolApp As New Outlook.Application
Public WithEvents myOlItems As Outlook.Items
Public Sub Initialize_handler()
Set myOlItems =
myolApp.GetNamespace("MAPI").GetDefaultFolder(olFolderSentMail).Items
End Sub
Public Sub myOlItems_ItemAdd(ByVal Item As Object)
Dim myInbox As Outlook.MAPIFolder
Dim myFolder As Outlook.MAPIFolder
Dim myNewFolder As Outlook.MAPIFolder
Set myFolder = myNameSpace.GetDefaultFolder(olFolderSentMail)
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myNewFolder = myInbox.Folders("EMAIL")
Item.Move myNewFolder
Item.UnRead = False
Item.Save
Debug.Print Item.Subject
End Sub
MS OUTLOOK 2003 on XP PRO.
What I'm trying to do:
I want to take every email I send, move it to a PST folder, and mark as read
using VBA since this isn't possible in a rule (specifically mark as read).
My Problem:
Through this forum and some other places, I think I have code that's at
least close to doing this. The problem is, the darn thing never triggers.
Please help me with this code. Thank you.
All of what follows is the entirety of a class module.
Dim myolApp As New Outlook.Application
Public WithEvents myOlItems As Outlook.Items
Public Sub Initialize_handler()
Set myOlItems =
myolApp.GetNamespace("MAPI").GetDefaultFolder(olFolderSentMail).Items
End Sub
Public Sub myOlItems_ItemAdd(ByVal Item As Object)
Dim myInbox As Outlook.MAPIFolder
Dim myFolder As Outlook.MAPIFolder
Dim myNewFolder As Outlook.MAPIFolder
Set myFolder = myNameSpace.GetDefaultFolder(olFolderSentMail)
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myNewFolder = myInbox.Folders("EMAIL")
Item.Move myNewFolder
Item.UnRead = False
Item.Save
Debug.Print Item.Subject
End Sub