I\'m trying to save attachments automatically to a local folder using Outlook 2010.
It works when I first create the rule and apply it to all inbox. It doesn\'t work
Replace your Outlook Rule with Items.ItemAdd Event (Outlook) see example
Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim olNs As Outlook.NameSpace
Dim Inbox As Outlook.MAPIFolder
Set olNs = Application.GetNamespace("MAPI")
Set Inbox = olNs.GetDefaultFolder(olFolderInbox)
Set Items = Inbox.Items
End Sub
Private Sub Items_ItemAdd(ByVal Item As Object)
If TypeOf Item Is Outlook.MailItem Then
saveAttachtoDisk Item ' call sub
End If
End Sub
Application.Startup Event (Outlook) and Items.ItemAdd Event (Outlook)
Items.ItemAdd Event (Outlook) Occurs when one or more items are added to the specified collection. This event does not run when a large number of items are added to the folder at once. This event is not available in Microsoft Visual Basic Scripting Edition (VBScript).
Application.Startup Event (Outlook) Occurs when Microsoft Outlook is starting, but after all add-in programs have been loaded.
I finally found out the reason. It seems that using IMAP is not an option if I want to save attachments automatically. I switched to POP3 and everything works just fine.