每次选择消息时都会执行此代码。我希望这个代码只有在我编写新的邮件/回复/转发时才能执行。
Private Sub Application_ItemLoad(ByVal Item As Object)
Dim oAccount As Outlook.Explorer
If TypeName(Item) = "MailItem" Then
MsgBox ("this is mail")
Set oAccount = Application.ActiveExplorer
MsgBox (oAccount.CurrentFolder.FolderPath)
End If
End Sub
我想要实现的目标:当从特定帐户([email protected])撰写邮件时,在CC字段中添加收件人。
我是编程的菜鸟。
您可以测试MailItem.Sent属性以确定是撰写邮件还是阅读收到的邮件。
Private Sub Application_ItemLoad(ByVal Item As Object)
Dim oAccount As Outlook.Explorer
If TypeName(Item) = "MailItem" Then
If item.Sent Then
MsgBox "Not for processing"
Else
MsgBox "Processing this mail"
Set oAccount = Application.ActiveExplorer
MsgBox (oAccount.CurrentFolder.FolderPath)
End If
End If
End Sub