2014-04-30 2 views
0

사용자 중 한 명이 "보내기"를 클릭 할 때 폴더보기로 팝업 스크립트를 설정했습니다. 이렇게하면 보낸 전자 메일을 선택한 폴더에 넣을 수 있습니다.보낸 전자 메일의 복사본을 폴더에 저장

이메일은 여전히 ​​"보낸 편지함"과 선택한 폴더로 이동되기를 원합니다.

도움이 될 것입니다.

Private Sub Application_ItemSend(ByVal Item As Object, _ 
           Cancel As Boolean) 
    Dim objNS As NameSpace 
    Dim objFolder As MAPIFolder 
    On Error Resume Next 
    Set objNS = Application.Session 
    If Item.Class = olMail Then 
     Set objFolder = objNS.PickFolder 
     If Not objFolder Is Nothing And _ 
      IsInDefaultStore(objFolder) And _ 
      objFolder.DefaultItemType = olMailItem Then 
      Set Item.SaveSentMessageFolder = objFolder 
     Else 
      Set objFolder = _ 
       objNS.GetDefaultFolder(olFolderSentMail) 
      Set Item.SaveSentMessageFolder = objFolder 
     End If 
    End If 
    Set objFolder = Nothing 
    Set objNS = Nothing 
End Sub 
Public Function IsInDefaultStore(objOL As Object) As Boolean 
    Dim objApp As Outlook.Application 
    Dim objNS As Outlook.NameSpace 
    Dim objInbox As Outlook.MAPIFolder 
    Dim blnBadObject As Boolean 
    On Error Resume Next 
    Set objApp = objOL.Application 
    If Err = 0 Then 
     Set objNS = objApp.Session 
     Set objInbox = objNS.GetDefaultFolder(olFolderInbox) 
     Select Case objOL.Class 
      Case olFolder 
       If objOL.StoreID = objInbox.StoreID Then 
        IsInDefaultStore = True 
       Else 
        IsInDefaultStore = False 
       End If 
      Case olAppointment, olContact, olDistributionList, _ 
       olJournal, olMail, olNote, olPost, olTask 
       If objOL.Parent.StoreID = objInbox.StoreID Then 
        IsInDefaultStore = True 
       Else 
        IsInDefaultStore = False 
       End If 
      Case Else 
       blnBadObject = True 
     End Select 
    Else 
     blnBadObject = True 
    End If 
    If blnBadObject Then 
     MsgBox "This function isn't designed to work " & _ 
       "with " & TypeName(objOL) & _ 
       " objects and will return False.", _ 
       , "IsInDefaultStore" 
     IsInDefaultStore = False 
    End If 
    Set objApp = Nothing 
    Set objNS = Nothing 
    Set objInbox = Nothing 
End Function 

편집 :

내가이 추가 : 일

Set msg = Item.Copy 
msg.Move objNS.GetDefaultFolder(olFolderSentMail) 

. 하지만 날짜 정보를 저장하지는 않습니다. 사본을 저장하지만 "발송 된 항목"의 날짜는 "없음"으로 표시됩니다. 이메일은 읽지 않은 상태로 표시됩니다.

답변

0

가장 쉬운 방법은 "보낸 편지함"폴더에 모든 보낸 전자 메일을 복사하는 규칙을 설정하는 것입니다.

유일한 문제는 이메일이 읽지 않은 상태로 표시된다는 것입니다.

관련 문제