Pourquoi ne pas ce travail VBA Outlook 2007 (je suis en train de retirer un drapeau programatically)?

StackOverflow https://stackoverflow.com/questions/1734568

  •  20-09-2019
  •  | 
  •  

Question

J'ai un code qui ajoute un drapeau à un e-mail, mais lorsque je tente le code ci-dessous pour l'enlever, il ne semble pas avoir d'effet dans Outlook 2007.

    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
Était-ce utile?

La solution

Outlook 2007 ne prend pas en charge 2003 - drapeaux de style plus (il les cartes sur un drapeau de la tâche et la catégorie la plus appropriée couleur).

Le drapeau que vous essayez d'effacer est probablement un indicateur de tâche. Dans ce ce cas, l'exécution d'une

m.ClearTaskFlag
m.Save

va faire le travail.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top