
Originally Posted by
inxain
Hi
I use the following variation of the same script in Outlook 2003 to insert the date and time stamp before the file extension (not very elegant but it works)
Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "c:\a"
For Each objAtt In itm.Attachments
posr = InStrRev(objAtt.FileName, ".")
ext = Right(objAtt.FileName, Len(objAtt.FileName) - posr)
posl = InStr(objAtt.FileName, ".")
fname = Left(objAtt.FileName, posr - 1)
objAtt.SaveAsFile saveFolder & "\" & fname & "_" & Format(itm.ReceivedTime, "ddmmyyyy_hhmm") & "." & ext
Set objAtt = Nothing
Next
End Sub