-1

I need to replace the contents of the subject line of all incoming email (whatever it maybe ) with "EBIT Support" and that same mail then forwarded to the new and correct inbox- an ideas vey welcome!!

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
Cheryl
  • 1
  • 1

1 Answers1

0

I assume you are looking for VBA code. Do you have any code written at all?

I have some stock event code that can be adapted for your purposes:

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
JimmyPena
  • 8,694
  • 6
  • 43
  • 64