Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Don't Forget this line → 

Public WithEvents objInboxItems As Outlook.Items

Inbox:

Public WithEvents objInboxItems As Outlook.Items
Private Sub Application_Startup()
  Set objInboxItems = Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub objInboxItems_ItemAdd(ByVal Item As Object)
 MsgBox "New Inbox Item"
End Sub

Custom Folder ("Test") at same level as Inbox:

Public WithEvents objTestItems As Outlook.Items
Private Sub Application_Startup()
  Set objTestItems = Session.GetDefaultFolder(olFolderInbox).Parent.Folders("Test").Items
End Sub
Private Sub objTestItems _ItemAdd(ByVal Item As Object)
 MsgBox "New Test Item"
End Sub

Custom SubFolder underneath Inbox ("SubTest"):

Public WithEvents objSubTestItems As Outlook.Items
Private Sub Application_Startup()
  Set objSubTestItems = Session.GetDefaultFolder(olFolderInbox).Folders("SubTest").Items ' No ".Parent" which means don't go "Up one level"
End Sub
Private Sub objSubTestItems _ItemAdd(ByVal Item As Object)
 MsgBox "New SubTest Item"
End Sub

Default Folders:

NameValueDescription
olFolderCalendar9Calendar folder
olFolderContacts10Contacts folder
olFolderDeletedItems3Deleted Items folder
olFolderDrafts16Drafts folder
olFolderInbox6Inbox folder
olFolderJournal11Journal folder
olFolderJunk23Junk E-Mail folder
olFolderNotes12Notes folder
olFolderOutbox4Outbox folder
olFolderSentMail5Sent Mail folder
olFolderSuggestedContacts30Suggested Contacts folder
olFolderTasks13Tasks folder
olFolderToDo28To Do folder
olPublicFoldersAllPublicFolders18All Public Folders folder in Exchange Public Folders store (Exchange only)
olFolderRssFeeds25RSS Feeds folder
  • No labels