title: How to apply WithEvents on newly received mail?
body: <p>I'm trying to modify incoming emails in a specific folder and send it to another person.</p>
  <p>The part modify/send works.</p>
  <p>The script doesn't work when there is new email. It only works when I transfer it to myself.</p>
  <p>The beginning of the code:</p>
  <pre class="lang-vb prettyprint-override"><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(&quot;MAPI&quot;)
      ' default local Inbox
      Set Items = objNS.GetDefaultFolder(olFolderInbox).Folders(&quot;DI&quot;).Items
  End Sub
  
  Private Sub Items_ItemAdd(ByVal item As Object)
      Dim Msg As Outlook.MailItem
      If TypeName(item) = &quot;MailItem&quot; Then
          Set Msg = item
  </code></pre>