See ReceivedTime
Property
http://msdn.microsoft.com/en-us/library/office/aa171873(v=office.11).aspx
You added another \
to the end of C:\Temp\
in the SaveAs File line. Could be a problem. Do a test first before adding a path separator.
dateFormat = Format(itm.ReceivedTime, "yyyy-mm-dd H-mm")
saveFolder = "C:\Temp"
You have not set objAtt
so there is no need for "Set objAtt = Nothing
". If there was it would be just before End Sub
not in the loop.
Public Sub saveAttachtoDisk (itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String Dim dateFormat
dateFormat = Format(itm.ReceivedTime, "yyyy-mm-dd H-mm") saveFolder = "C:\Temp"
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & dateFormat & objAtt.DisplayName
Next
End Sub
Re: It worked the first day I started tinkering but after that it stopped saving files.
This is usually due to Security settings. It is a "trap" set for first time users to allow macros then take it away. http://www.slipstick.com/outlook-developer/how-to-use-outlooks-vba-editor/