K
kalikw
Hello,
I am able to write code (with the help of Martin Green's website) that can
copy attachments from the inbox or pst folder and put a copy of the
attachments on my network drive. However I would like to take it one step
further and have the VBA code look at the items in the folder and only copy
those attachments for mail that arrived on a specific date. For example copy
attachments for mail that arrive today or yesterday, or any specific date. I
looked in the help but I did not get the answer I was looking for, here is a
copy of the code.
Sub mailtest()
Dim ns As NameSpace
Dim mainFolder As MAPIFolder
Dim SubFolder As MAPIFolder
Dim SubFolder2 As MAPIFolder
Dim Item As Object
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
Set ns = GetNamespace("MAPI")
Set mainFolder = ns.Folders("Personal Folders")
Set SubFolder = mainFolder.Folders("Saved Mail")
Set SubFolder2 = SubFolder.Folders("Test")
i = 0
For Each Item In SubFolder2.Items
For Each Atmt In Item.Attachments
FileName = "H:\Karen W\APC Aide Staff\Email Attachments\" & Atmt.FileName
Atmt.SaveAsFile FileName
i = i + 1
Next Atmt
Next Item
End If
End Sub
Any help would be appreciate.
Karen
I am able to write code (with the help of Martin Green's website) that can
copy attachments from the inbox or pst folder and put a copy of the
attachments on my network drive. However I would like to take it one step
further and have the VBA code look at the items in the folder and only copy
those attachments for mail that arrived on a specific date. For example copy
attachments for mail that arrive today or yesterday, or any specific date. I
looked in the help but I did not get the answer I was looking for, here is a
copy of the code.
Sub mailtest()
Dim ns As NameSpace
Dim mainFolder As MAPIFolder
Dim SubFolder As MAPIFolder
Dim SubFolder2 As MAPIFolder
Dim Item As Object
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
Set ns = GetNamespace("MAPI")
Set mainFolder = ns.Folders("Personal Folders")
Set SubFolder = mainFolder.Folders("Saved Mail")
Set SubFolder2 = SubFolder.Folders("Test")
i = 0
For Each Item In SubFolder2.Items
For Each Atmt In Item.Attachments
FileName = "H:\Karen W\APC Aide Staff\Email Attachments\" & Atmt.FileName
Atmt.SaveAsFile FileName
i = i + 1
Next Atmt
Next Item
End If
End Sub
Any help would be appreciate.
Karen