FractalWalk
Technical User
I am an experienced VBA user in Excel but I have never written anything for outlook. I have a local folder that contains individual email files that I need to open using Excel 2007 VBA
My problem is I don't know how to open the email files in a format to read them. For example, if it were plain text files I would use:
Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder("TargetFolder")
For Each fil In fld.Files
Open fil For Input As #1
Next fil
I assume I have to open an OUtlook object and reference the folder, but how do I open the file and read it? I assume it would be something like the following but with appropriate code.
Set appOutlook = CreateObject("Outlook.Application")
Set fld = appOutlook.GetFolder("TargetFolder")
For Each eml In ?
Code to open email
Next fil
I have reasearched the Outlook.Application object but none of what I read helps me reference it from Excel.
My problem is I don't know how to open the email files in a format to read them. For example, if it were plain text files I would use:
Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder("TargetFolder")
For Each fil In fld.Files
Open fil For Input As #1
Next fil
I assume I have to open an OUtlook object and reference the folder, but how do I open the file and read it? I assume it would be something like the following but with appropriate code.
Set appOutlook = CreateObject("Outlook.Application")
Set fld = appOutlook.GetFolder("TargetFolder")
For Each eml In ?
Code to open email
Next fil
I have reasearched the Outlook.Application object but none of what I read helps me reference it from Excel.