2009-11-14 24 views
1

我有一些代碼,增加了一個標誌的電子郵件,但是當我嘗試下面這段代碼刪除它,它似乎並沒有在Outlook中有任何影響2007年爲什麼不這個Outlook 2007 VBA工作(我試圖以編程方式刪除標誌)?

Public Sub Clear() 
     Dim objOutlook As Outlook.Application 
     Dim objInspector As Outlook.Inspector 

     Dim strDateTime As String 

     ' Instantiate an Outlook Application object. 
     Set objOutlook = CreateObject("Outlook.Application") 

     ' The ActiveInspector is the currently open item. 
     Set objExplorer = objOutlook.ActiveExplorer 

     ' Check and see if anything is open. 
     If Not objExplorer Is Nothing Then 
      ' Get the current item. 
      Dim arySelection As Object 
      Set arySelection = objExplorer.Selection 

      For x = 1 To arySelection.Count 
       Dim m As MailItem 
       Set m = arySelection.Item(x) 
       m.Categories = "" 
       m.FlagStatus = olNoFlag 
       m.FlagIcon = 0 
       m.Save 
      Next x 

     Else 
      ' Show error message with only the OK button. 
      MsgBox "No explorer is open", vbOKOnly 
     End If 

    End Sub 

回答

2
Outlook 2007中

不支持2003年 - 樣式標誌(它將它們映射到任務標誌和最合適的類別顏色)。

您試圖清除的標誌可能是任務標誌。在那種情況下,執行

m.ClearTaskFlag 
m.Save 

將完成這項工作。

+0

工程就像一個魅力 – leora 2009-11-14 21:16:52

相關問題