-1

我需要用“EBIT Support”替换所有传入电子邮件(无论它可能是什么)的主题行的内容,然后将相同的邮件转发到新的正确收件箱 - 欢迎提出想法!

4

1 回答 1

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
于 2011-09-08T19:48:38.967 回答