自动替换入站Outlook电子邮件中的主题行

时间:2011-07-12 20:20:45

标签: outlook-2003 email-headers

我需要用“EBIT支持”替换所有收到的电子邮件(无论如何)的主题行的内容,然后将相同的邮件转发到新的正确收件箱 - 欢迎提出想法!

1 个答案:

答案 0 :(得分:0)

我假设您正在寻找VBA代码。你有任何代码吗?

我有一些股票事件代码可以根据您的目的进行调整:

http://www.codeforexcelandoutlook.com/outlook-vba/stock-event-code/

Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Set olApp = Outlook.Application
Set objNS = olApp.GetNamespace("MAPI")
' (1) default Inbox
Set Items = objNS.GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub Items_ItemAdd(ByVal item As Object)

On Error Goto ErrorHandler

  Dim Msg As Outlook.MailItem

  ' (2) only act if it's a MailItem
  If TypeName(item) = "MailItem" Then
    Set Msg = item

    ' (3) do something here

  End If

ProgramExit:
  Exit Sub
ErrorHandler:
  MsgBox Err.Number & " - " & Err.Description
  Resume ProgramExit
End Sub