Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DataSolveProblems/0044fa3c1d0e998d2c059b8bf75c2ff4 to your computer and use it in GitHub Desktop.
Save DataSolveProblems/0044fa3c1d0e998d2c059b8bf75c2ff4 to your computer and use it in GitHub Desktop.
Sub Retrieve_SubFolder_Emails()
Dim ns As NameSpace
Dim olInboxFolder As MAPIFolder, olSubFolder As MAPIFolder
Dim msg As MailItem
Set ns = GetNamespace("MAPI")
Set olInboxFolder = ns.GetDefaultFolder(olFolderInbox)
Set olSubFolder = olInboxFolder.Folders("Sub Folder")
For Each msg In olSubFolder.Items
Debug.Print "Subject: " & msg.Subject
Debug.Print "Email Body: " & msg.Body
Debug.Print "Sender Email: " & msg.SenderEmailAddress
Next msg
'// Release memories
Set olSubFolder = Nothing
Set olInboxFolder = Nothing
Set ns = Nothing
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment