【发布时间】:2015-12-18 11:01:39
【问题描述】:
我有一个宏,可以检查电子邮件中的附件并分配一个类别。我需要保留现有的类别。它目前删除了所有旧的。
Sub Categories()
If Item.Attachments.Count > 0 Then
Dim attCount As Long
Dim strFile As String
Dim sFileType As String
Set attCount = Item.Attachments.Count
For i = attCount To 1 Step -1
strFile = Item.Attachments.Item(i).FileName
sFileType = LCase$(Right$(strFile, 4))
Select Case sFileType
Case ".wwb", ".sdd"
' do something if the file types are found
' this code assigns a cateogry to the message
Item.Categories = "WWB"
Item.Save
' stop checking if a match is found and exit sub
GoTo endsub
End Select
Next i
End If
endsub:
Set Item = Nothing
End Sub
【问题讨论】: