Thanks so much for your reply...
I added the code to the bottom of my previous code (apologies - perhaps I should of given that in the first place)
Sub Email()
On Error GoTo extraction_err
Dim Ns As NameSpace
Dim Item As Object
Dim subfolder As MAPIFolder
Dim atmt As Attachment
Dim filename As String
Dim i As Integer
Set Ns = GetNamespace("MAPI")
Set Inbox = Ns.GetDefaultFolder(olFolderInbox)
Set subfolder = Inbox.Folders("Z EXAMPLE")
i = 0
If subfolder.Items.Count = 0 Then
MsgBox "This folder has No Messages." _
, vbInformation, "Nothing Found"
Exit Sub
End If
If subfolder.Items.Count > 0 Then
For Each Item In subfolder.Items
For Each atmt In Item.Attachments
filename = "C:\EXAMPLE.csv"
atmt.SaveAsFile filename
'If item.fileexists("atmt.filename") Then
'filename = "C:\Email Attachments" & _
'Format(item.CreationTime, "yyyymmdd_hhnnss_") & atmt.filename
'End If
i = i + 1
Next atmt
Next Item
End If
If i > 0 Then
MsgBox "Found " & i & " attached files." _
& vbCrLf & "Saved to designated folder" _
, vbInformation, "finished!"
Else
MsgBox "There was no files attached to these emails.", vbInformation, _
"finished!"
End If
extraction_exit:
Set atmt = Nothing
Set Item = Nothing
Set Ns = Nothing
Exit Sub
extraction_err:
MsgBox "An unexpected error has occured." _
& vbCrLf & "Please note and report the following information." _
& vbCrLf & "Macro Name: extraction" _
& vbCrLf & "Error Number: " & Err.Number _
& vbCrLf & "Error Description: " & Err.Description _
, vbCritical, "Error!"
Resume extraction_exit
'Moves Email into reviewed folder.
Set myDestFolder = myNameSpace.GetDefaultFolder(olFolderInbox).Folders("_Reviewed")
myItem.Move myDestFolder
Exit Sub
End Sub
So in esscence, after I have extracted the attatchment I would like the email in ZExample folder to then feed into _Reviewed folder.
I just re run the macro with the new added code as per above, and it does not move the email to _Reviewed folder.
Thank you for the code though, its helped me get a rough idea of what im looking for, if you can see the above and see where i have gone wrong that would be amazing.