Driving Outlook from Access

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I have an Access 2k app that retrieves email data from Outlook. The emails
are in Outlook in a folder in the in box called YetToBeDone.

I am currently able to read the data and populate a table within Access.

Once this has been done I want Access to programmatically move the email
from the YetToBeDone folder to a folder called Done

Is this possible?

Thanks
 
Dave said:
I have an Access 2k app that retrieves email data from Outlook. The emails
are in Outlook in a folder in the in box called YetToBeDone.

I am currently able to read the data and populate a table within Access.

Once this has been done I want Access to programmatically move the email
from the YetToBeDone folder to a folder called Done

Is this possible?

Probably. Post your code, and I'll see what I can find in my application
code that might match what you're doing.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
OK - here it is

Public Sub GetBooking()

Dim objOutlook As New Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim MailMsg As Outlook.MailItem

Dim objItem As Object
Dim strSubFolderName As String
Dim strEmailBody As String

strSubFolderName = "YetToBeDOne" 'Name of the subfolder under In box

Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objFolder =
objNameSpace.GetDefaultFolder(olFolderInbox).Folders(strSubFolderName) 'set
to subfolder.

For Each MailMsg In objFolder.Items
Debug.Print strEmailBody
'Arvin - now that I have got the information, I want to move the
mail to a folder called Done
Next
End Sub
 
Hi Dave,
Just use the Move method of your mail item object.

Set flderDone = objNameSpace.GetDefaultFolder(olFolderInbox).Folders("Done")

MailMsg.Move flderDone
 
Back
Top