【问题标题】:Add category without removing existing categories添加类别而不删除现有类别
【发布时间】: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

【问题讨论】:

    标签: vba outlook


    【解决方案1】:

    试试

    Item.Categories = Item.Categories & "," & "WWB"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-25
      • 2011-06-05
      • 2011-08-05
      • 1970-01-01
      • 1970-01-01
      • 2015-02-16
      • 1970-01-01
      相关资源
      最近更新 更多