I am trying to figure out how to keep track of the number of mail items going into a folder by putting a listener on that folder but it isn't working right. This is what I have but for some reason the selected amount isn't correct when I drag multiple emails to that folder. Basically what I am trying to do with the folder is change all the names of the mail items that are dragged into it to the same name. So I need to be able to have a way to reference those items that are being dragged in. I thought I could do this by using Selection but I'm not sure. Any ideas?? Thank you! Here's my code:
Private WithEvents MatchTicketNumberItems As Outlook.Items
Private Sub Application_Startup()
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Set olApp = Outlook.Application
Set objNS = olApp.GetNamespace("MAPI")
'Specify folders that will have listeners on them
Set MatchTicketNumberItems = objNS.GetDefaultFolder(olFolderInbox).Parent.Folders("MatchTicketNumber").Items
End Sub
Private Sub MatchTicketNumberItems_ItemAdd(ByVal item As Object)
Dim selected As Integer
Dim objSelection As Outlook.Selection
Set objSelection = Application.ActiveExplorer.Selection
selected = objSelection.count
'Do stuff
End Sub