2013-10-15 4 views
-1

특정 메일에 답장을 보내고 싶습니다.메일이 답장되었는지 여부를 확인하십시오.

나는 그물에 코드를 발견하지만

아웃룩 2010에없는 CDO 라이브러리를 사용하고있다가하는 VBA 상당 : [Message.Fields를 사용하는 대신에

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 
+0

... 무엇이 문제입니까? 컴파일되지 않고 작동하지 않습니까? 예기치 않은 동작을 나타냅니다. 우리 중 누구도 당신의 마음을 읽을 수 없습니다 - "문제"는 매우 일반적입니다. – enderland

+0

다음을보십시오 : [VBA in Outlook에서 전자 메일 대화의 "회신"또는 "전달 된"상태를 얻으려면?] (http://stackoverflow.com/questions/15320510/vba-in-outlook-to-get-replied- 전달 상태 - 이메일 대화) –

답변

0

], OutlookSpy와 메시지에서 찾습니다 DALS 속성 이름을 확인하려면 MailItem.PropertyAccessor.GetProperty

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

를 사용, iMessage를을 클릭의 속성을 선택 질문은 DASL 입력란을 참조하십시오.

관련 문제