Receviing and recending mail

Home-›Foren-›Outlook-›Outlook VBA-›Receviing and recending mail

1 Antwort anzeigen (von insgesamt 1)
  • Autor
  • #43239

      I have the task – when Outlook receives the mail it should create a new message, attach to it the income mail and send it to one more recepient. In this connection I wrote the class module for event of receiving new mail

      Dim myOlApp As New Outlook.Application
      Public WithEvents myOlItems As Outlook.Items

      Public Sub Initialize_handler()
      Set myOlItems = myOlApp.GetNamespace(“MAPI”).GetDefaultFolder(olFolderInbox).Items
      End Sub

      Private Sub myOlItems_ItemAdd(ByVal Item As Object)
      Dim OutlInspector As Outlook.Inspector
      Dim myOlAtts As Outlook.Attachments
      Dim myOlMItem As Outlook.MailItem

      Set myOlMItem = myOlApp.CreateItem(olMailItem)
      myOlMItem.Attachments.Add Item, olByValue
      Set OutlInspector = Outlook.ActiveInspector
      Set myOlMItem = OutlInspector.CurrentItem
      myOlMItem.Recipients.Add “”
      ‘myOlMItem.DeleteAfterSubmit = True

      Set myOlMItem = Nothing
      End Sub

      and the following code in the module:

      Dim x As New EventClassModule

      Sub Registration()
      Set x.myOlItems = Outlook.Application.GetNamespace(“MAPI”).GetDefaultFolder(olFolderInbox).Items
      End Sub

      It works perfectly. The problem, which I can’t deal – hide the process of creating new message and resending it.

      I know that in Excel exists possibility to switch off the updating the screeen

      Is there in Outlook the opportunity like that???
      Thank in advance.

    1 Antwort anzeigen (von insgesamt 1)


    Hat Ihnen der Beitrag gefallen?

    1 Stern2 Sterne3 Sterne4 Sterne5 Sterne (Keine Bewertung vorhanden)