Welcome to FreeSoftwareServers Confluence Wiki

https://stackoverflow.com/questions/24321752/outlook-vba-how-to-loop-through-inbox-and-list-from-email-email-address-if-subje

Public Sub Sort_AllInboxItems()

 Dim objNS As Outlook.NameSpace: Set objNS = GetNamespace("MAPI")
 Dim olFolder As Outlook.MAPIFolder
 Set olFolder = objNS.GetDefaultFolder(olFolderInbox)
 
 Dim oItem As Object
 Dim objMail As Outlook.MailItem

 NoWaitBool = True

 For Each oItem In olFolder.Items
  If oItem.Class = olMail Then
   Set objMail = oItem
   Call objInboxItems_ItemAdd(objMail)
  End If
 Next oItem
 
 NoWaitBool = False
End Sub
  • No labels