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
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