I have an Access DB which sends a survey out to users as an HTML POST form embedded in an Outlook email. When the user submits the form, it sends a reply email with the form data in an attached file POSTDATA.ATT. This file is a very simple text file which I was hoping I could read into the Access DB. I need help actually getting to this file from my Inbox and cracking it open to get at the goodness inside. Basically, I want to do something like this:
the ??????? marks where I would like to read in the attachment's contents. Can I do this directly? If not, I know how to read from a file on my hard drive. But how can I save the attachment?
Thanks,
Johnny Geo
Code:
Dim myOutlook As Outlook.Application
Dim myNS As Outlook.NameSpace
Dim myfolders As Outlook.Folders
Dim mySurveyFolder As Outlook.MAPIFolder
Dim myEmail As MailItem
Dim myAttach as Attachment
Set myOutlook = CreateObject("Outlook.Application")
Set myNS = myOutlook.GetNamespace("MAPI")
Set myfolders = myNS.Folders
Set mySurveyFolder = myfolders("SurveyAccount").Folders("Inbox")
For Each myEmail In mySurveyFolder.Items
If myEmail.Attachments.Count > 0 Then
set myAttach = myEmail.Attachments(1)
???????
???????
End if
Next myEmail
Thanks,
Johnny Geo