2017-09-05 107 views
0

我的代碼如下所示:進入了CC領域進入到域

Public WithEvents myItem As Outlook.MailItem 

Private Sub Application_ItemLoad(ByVal Item As Object) 
    If Item.Class = olMail Then 
     Set myItem = Item 
    End If 
End Sub 


Private Sub myItem_Open(Cancel As Boolean) 
    Dim oAccount As Outlook.Explorer 
    Dim oMail As MailItem 
    Dim Recip As Outlook.Recipient 

    Set oAccount = Application.ActiveExplorer 
    MsgBox (oAccount.CurrentFolder.Store) 

    If oAccount.CurrentFolder.Store = "[email protected]" Then 
     MsgBox ("CC needs to be added") 

     Set Recip = myItem.Recipients.Add("[email protected]") 
     Recip.Type = olBCC 
    Else 
     MsgBox ("no need to add CC") 
    End If 
End Sub 

負責添加[email protected]到CC字段添加該地址的一部分「到:」而不是。

+1

如果是VBA,請使用vba標籤。 VB.NET是別的東西 – Plutonix

回答

0

我只需在Recip.Type = olCC後添加Recip.Resolve。這解決了這個問題。