Outlook programming : Looping individual mails inside the Inbox

    1:  'myLoop method
    2:  Sub myLoop()
    3:   
    4:     'Declaration
    5:      Dim olApp As Outlook.Application
    6:      Dim olNs As Outlook.NameSpace
    7:      Dim olFldr As Outlook.MAPIFolder
    8:      Dim olItms As Outlook.Items
    9:      Dim olMail As Object
   10:   
   11:      Set olApp = New Outlook.Application
   12:      Set olNs = olApp.GetNamespace("MAPI")
   13:      Set olFldr = olNs.GetDefaultFolder(olFolderInbox)
   14:      Set olItms = olFldr.Items
   15:   
   16:      'Loop the items     
   17:      For Each olMail In olItms
   18:          'Here you need to use olMail Object to inspect individual mails inside the Inbox
   19:      Next olMail
   20:   
   21:      'Release the objects appropriately
   22:      Set olFldr = Nothing
   23:      Set olNs = Nothing
   24:      Set olApp = Nothing
   25:  End Sub