Vba 确定邮件是否已回复

Vba 确定邮件是否已回复,vba,outlook,outlook-2010,Vba,Outlook,Outlook 2010,我想知道某封邮件是否已被回复 我在网上找到了代码,但它使用了Outlook 2010中没有的CDO库 是否有一个VBA等效于: Sub ShowVerbText() Dim objItem As Object Dim cdoSession As MAPI.Session Dim cdoMessage As MAPI.Message Dim cdoField As MAPI.Field Dim objFolder As Outlook.MAPIFolder

我想知道某封邮件是否已被回复

我在网上找到了代码,但它使用了Outlook 2010中没有的CDO库

是否有一个VBA等效于:

Sub ShowVerbText()
    Dim objItem As Object
    Dim cdoSession As MAPI.Session
    Dim cdoMessage As MAPI.Message
    Dim cdoField As MAPI.Field
    Dim objFolder As Outlook.MAPIFolder
    Dim strEntryID As String
    Dim strStoreID As String
    Const cdoPR_LAST_VERB_EXECUTED = &H10810003
    Const cdoPR_LAST_VERB_EXECUTION_TIME = &H10820040
    Dim strLastVerb As String
    Dim intLastVerb As Integer
    Dim dteLastVerbTime As Date
    Dim strLastVerbTime As String
    On Error Resume Next

    ' GetCurrentItem function is available at
    ' http://www.outlookcode.com/codedetail.aspx?id=50
    Set objItem = GetCurrentItem()
    If objItem.Class = olMail Then
        If objItem.Sent = True Then
            ' get EntryID and StoreID from item
            Set objFolder = objItem.Parent
            strEntryID = objItem.EntryID
            strStoreID = objFolder.StoreID
            ' initiate CDO session
            Set cdoSession = CreateObject("MAPI.Session")
            cdoSession.Logon "", "", False, False
            ' get same item as CDO Message
            Set cdoMessage = cdoSession.GetMessage(strEntryID, strStoreID)
            Set cdoField = cdoMessage.Fields(cdoPR_LAST_VERB_EXECUTED)
            If Not cdoField Is Nothing Then
                intLastVerb = cdoField.Value
                strLastVerb = LastVerbText(intLastVerb)
                Set cdoField = cdoMessage.Fields(cdoPR_LAST_VERB_EXECUTION_TIME)
                If Not cdoField Is Nothing Then
                    dteLastVerbTime = cdoField.Value
                    strLastVerbTime = FormatDateTime(dteLastVerbTime, vbGeneralDate)
                End If
            Else
                strLastVerb = "No reply or forward"
            End If

            MsgBox strLastVerb & vbCrLf & strLastVerbTime
        End If
    End If

    cdoSession.Logoff
    Set cdoSession = Nothing
    Set cdoMessage = Nothing
    Set cdoField = Nothing
    Set objFolder = Nothing
    Set objItem = Nothing
End Sub

Function LastVerbText(intVerb As Integer)
    ' REFERENCE: http://doc.ddart.net/msdn/header/include/exchform.h.html
    Select Case intVerb
        Case 102
            LastVerbText = "Reply to Sender"
        Case 103
            LastVerbText = "Reply to All"
        Case 104
            LastVerbText = "Forward"
        Case 108
            LastVerbText = "Reply to Forward"
        Case Else
            LastVerbText = "Verb not in list. " & vbCrLf & vbCrLf & _
                "See http://doc.ddart.net/msdn/header/include/exchform.h.html"
    End Select
End Function

使用MailItem.PropertyAccessor.GetProperty代替Message.Fields[]

intLastVerb = objItem.PropertyAccessor.getProperty("http://schemas.microsoft.com/mapi/proptag/0x10810003")

要查看DALS属性名称,请查看以下消息:单击IMessage,选择有问题的属性,查看DASL编辑框。

。。。你有什么问题?它不工作,不编译,表现出意外的行为吗?我们没有人能读懂你的心思——“问题”在这里非常普遍。看看这里: