djchou
10-09-2007, 01:45 PM
Hi,
I've tried creating a rule that runs a script every time an email is sent to a email distribution.
For some reason, the rule does not save the attachments. Can someone please help?!
Sub attachmentrule(item As Outlook.MailItem)
Dim atmt As Attachment
Dim i As Integer
If item.Attachments.Count > 0 Then
For i = 1 To item.Attachments.Count
If Right(atmt.FileName, 3) = "xls" Then
FileName = "T:\Operations\Excel Attachments\" & Format(item.ReceivedTime, "yyyymmdd_hhnnss_") & atmt.FileName
atmt.SaveAsFile FileName
End If
Next
End If
Set atmt = Nothing
End Sub
I've tried creating a rule that runs a script every time an email is sent to a email distribution.
For some reason, the rule does not save the attachments. Can someone please help?!
Sub attachmentrule(item As Outlook.MailItem)
Dim atmt As Attachment
Dim i As Integer
If item.Attachments.Count > 0 Then
For i = 1 To item.Attachments.Count
If Right(atmt.FileName, 3) = "xls" Then
FileName = "T:\Operations\Excel Attachments\" & Format(item.ReceivedTime, "yyyymmdd_hhnnss_") & atmt.FileName
atmt.SaveAsFile FileName
End If
Next
End If
Set atmt = Nothing
End Sub