Created
April 30, 2019 12:19
-
-
Save DataSolveProblems/0044fa3c1d0e998d2c059b8bf75c2ff4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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