2017-09-05 94 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。这解决了这个问题。