我的代码如下所示:
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 = "1@2.com" Then
MsgBox ("CC needs to be added")
Set Recip = myItem.Recipients.Add("user@test.com")
Recip.Type = olBCC
Else
MsgBox ("no need to add CC")
End If
End Sub
负责将user@test.com添加到CC字段的部分正在将该地址添加到“收件人:”字段中。
答案 0 :(得分:0)
我只需在Recip.Type = olCC之后添加Recip.Resolve。这解决了这个问题。