M
Marc Vissers
Hello,
As I regularly get spam in my mailbox with a blank subject line I copied a
piece of VB code from the MS Knowledge Base article 253313 in order to move
these items to another folder :
---
' The first two "Dim" statements declare
' global variables, and must be located in
' the "General Declarations" section at
' the beginning of the Code window.
Dim WithEvents objInboxItems As Outlook.Items
Dim objDestinationFolder As Outlook.MAPIFolder
' Run this code to start your rule.
Sub StartRule()
Dim objNameSpace As Outlook.NameSpace
Dim objInboxFolder As Outlook.MAPIFolder
Set objNameSpace = Application.Session
Set objInboxFolder = objNameSpace.GetDefaultFolder(olFolderInbox)
Set objInboxItems = objInboxFolder.Items
Set objDestinationFolder = objInboxFolder.Folders("Temp")
End Sub
' Run this code to stop your rule.
Sub StopRule()
Set objInboxItems = Nothing
End Sub
' This code is the actual rule.
Private Sub objInboxItems_ItemAdd(ByVal Item As Object)
If Item.Subject = "" Then
Item.Move objDestinationFolder
End If
End Sub
---
It does the job very well but I would like to make life even easier for me
and modify the code above so that the items go straight into the 'Deleted
Items' folder (called 'Verwijderde items' in the Flemish/Dutch version of
Outlook). How do I change the code exactly to get it done ? Note that the
'Temp' folder is a subfolder of the Inbox folder in the above example, so
just replacing "Temp" with "Verwijderde Items" didn't work. Any help is
greatly appreciated. Thanks very much in advance.
Marc
Belgium
As I regularly get spam in my mailbox with a blank subject line I copied a
piece of VB code from the MS Knowledge Base article 253313 in order to move
these items to another folder :
---
' The first two "Dim" statements declare
' global variables, and must be located in
' the "General Declarations" section at
' the beginning of the Code window.
Dim WithEvents objInboxItems As Outlook.Items
Dim objDestinationFolder As Outlook.MAPIFolder
' Run this code to start your rule.
Sub StartRule()
Dim objNameSpace As Outlook.NameSpace
Dim objInboxFolder As Outlook.MAPIFolder
Set objNameSpace = Application.Session
Set objInboxFolder = objNameSpace.GetDefaultFolder(olFolderInbox)
Set objInboxItems = objInboxFolder.Items
Set objDestinationFolder = objInboxFolder.Folders("Temp")
End Sub
' Run this code to stop your rule.
Sub StopRule()
Set objInboxItems = Nothing
End Sub
' This code is the actual rule.
Private Sub objInboxItems_ItemAdd(ByVal Item As Object)
If Item.Subject = "" Then
Item.Move objDestinationFolder
End If
End Sub
---
It does the job very well but I would like to make life even easier for me
and modify the code above so that the items go straight into the 'Deleted
Items' folder (called 'Verwijderde items' in the Flemish/Dutch version of
Outlook). How do I change the code exactly to get it done ? Note that the
'Temp' folder is a subfolder of the Inbox folder in the above example, so
just replacing "Temp" with "Verwijderde Items" didn't work. Any help is
greatly appreciated. Thanks very much in advance.
Marc
Belgium