Change Folder

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

I have a excel spreadsheet that is attached to an email
sent to me at least one a day. I use VB to move it to a
folder and imported to Access. What I want to happen is
when this email has been sent I want to move the email to
another folder. The reason being I am not sure what will
happen when they are two email messages left in the inbox.
Here is my VB statement.
Sub AttachmentImport()
On Error Resume Next
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

End Sub
..
 
Thanks for your response.I only have Microsoft Outlook
10.0 Object Library. I don't have 11.0. Isn't that where
the MailItem.move is at?
 
No, it is available in 10.0, too. Please press F2 from within the VBA
environment, switch then from <All Libraries> to Outlook. In the left
pane you´ll see all classes, in the
right one their methods, properties, etc.

--
Viele Grüße
Michael Bauer - MVP Outlook


Thanks for your response.I only have Microsoft Outlook
10.0 Object Library. I don't have 11.0. Isn't that where
the MailItem.move is at?
 
Back
Top