У меня есть макрос, который проверяет электронную почту на наличие вложения и назначает категорию. Мне нужно сохранить существующие категории. В настоящее время он удаляет все старые.
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