Email to Access

T

Tom

I am using Microsoft Outlook to email a message to me with an attach file
that is moved to a folder on a server and then Access is updating this Excel
spreadsheet. It works fine. The challenge is to move this email, after the
attached file has been processed, and moved to another folder in Microsoft
Outlook. The process only works with one Email and I'm trying have only one
email at a time.

Dim ns As Namespace
Dim Inbox As MAPIFolder
Dim Item As Object
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
' MsgBox "Program is running"
DoCmd.Hourglass True

Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
'i = 0
For Each Item In Inbox.Items
For Each Atmt In Item.Attachments
If Atmt.FileName = "Grainger.xls" Or "GrainRec.xls" Then
FileName = "\\wp01\opendata\Antrim\Grainger\" & Atmt.FileName
Atmt.SaveAsFile FileName
' i = i + 1
End If
Next Atmt
Next Item
DoCmd.Hourglass False
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top