I'm not exactly interested in automating Outlook but rather just to be able to examine emails that I've stored in a particular Outlook folder. For example I have the following which reads the Subject and Body of everything in the Inbox. It does what I want to do except that rather than the Inbox I want to drill down to one of my personal folders and I so far can't figure out how to do that.
Code:
Dim myOLApp As New Outlook.Application
Dim olNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim i As Integer
Dim strSubject As String
Dim strBody As String
Set myOLApp = CreateObject("Outlook.Application")
Set olNameSpace = myOLApp.GetNamespace("MAPI")
Set myFolder = olNameSpace.GetDefaultFolder(olFolderInbox) ' This is the line I need to change/replace
For i = 1 To myFolder.Items.Count
strSubject = myFolder.Items(i).Subject
strBody = myFolder.Items(i).Body
Next
Set myOLApp = Nothing
Set olNameSpace = Nothing