Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private WithEvents snItems As Items
- Private Sub Application_Startup()
- Set snItems = Session.GetDefaultFolder(olFolderSentMail).Items
- End Sub
- Private Sub snItems_ItemAdd(ByVal item As Object)
- Dim CopiedItem As MailItem
- Dim ShareInbox As Outlook.MAPIFolder
- Dim MapiNameSpace As Outlook.NameSpace
- If TypeName(item) = "MailItem" Then
- Set MapiNameSpace = Application.GetNamespace("MAPI")
- Set ShareInbox = MapiNameSpace.Folders("Support").Folders("Send Mails")
- If item.SenderName = "Support" Then
- Set CopiedItem = item.Copy
- CopiedItem.UnRead = True
- CopiedItem.Move ShareInbox
- End If
- End If
- 'MsgBox "Awesome"
- ExitRoutine:
- Set ShareInbox = Nothing
- Set CopiedItem = Nothing
- Set MapiNameSpace = Nothing
- End Sub
- Set MapiNameSpace = Application.GetNamespace("MAPI")
- Set ShareInbox = MapiNameSpace.Folders("Support").Folders("Gesendete Elemente")
- If item.SenderName = "Support" Then
- item.Move ShareInbox
- End If
- Private Sub snItems_ItemAdd(ByVal item As Object)
- Dim CopiedItem As MailItem
- Dim ShareInbox As Outlook.MAPIFolder
- Dim MapiNameSpace As Outlook.NameSpace
- If TypeName(item) = "MailItem" Then
- Set MapiNameSpace = Application.GetNamespace("MAPI")
- Set ShareInbox = MapiNameSpace.Folders("Support").Folders("Send Mails")
- If item.SenderName = "Support" Then
- ' Turn off event handling
- Set snItems = Nothing
- Set CopiedItem = item.Copy
- CopiedItem.UnRead = True
- CopiedItem.Move ShareInbox
- ' Turn on event handling
- Set snItems = Session.GetDefaultFolder(olFolderSentMail).Items
- End If
- End If
- ExitRoutine:
- Set ShareInbox = Nothing
- Set CopiedItem = Nothing
- Set MapiNameSpace = Nothing
- End Sub
Add Comment
Please, Sign In to add comment