Home-›Foren-›Outlook-›Outlook VBA-›Receviing and recending mail
- Dieses Thema hat 0 Antworten und 1 Teilnehmer, und wurde zuletzt aktualisiert 10:11 um 4. Oktober 2007 von Andrew_nik.
- AutorBeitrag
- 4. Oktober 2007 um 10:11 Uhr #43239Andrew_nikTeilnehmer
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
[code]
Dim myOlApp As New Outlook.Application
Public WithEvents myOlItems As Outlook.ItemsPublic Sub Initialize_handler()
Set myOlItems = myOlApp.GetNamespace(“MAPI”).GetDefaultFolder(olFolderInbox).Items
End SubPrivate Sub myOlItems_ItemAdd(ByVal Item As Object)
Dim OutlInspector As Outlook.Inspector
Dim myOlAtts As Outlook.Attachments
Dim myOlMItem As Outlook.MailItemSet myOlMItem = myOlApp.CreateItem(olMailItem)
myOlMItem.Display
myOlMItem.Attachments.Add Item, olByValue
Set OutlInspector = Outlook.ActiveInspector
Set myOlMItem = OutlInspector.CurrentItem
myOlMItem.Recipients.Add “nikolenko1980@mail.ru”
‘myOlMItem.DeleteAfterSubmit = TruemyOlMItem.Send
Set myOlMItem = Nothing
End Sub
[/code]and the following code in the module:
[code]
Dim x As New EventClassModuleSub Registration()
Set x.myOlItems = Outlook.Application.GetNamespace(“MAPI”).GetDefaultFolder(olFolderInbox).Items
End Sub
[/code]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
[code]
Application.ScreenUpdating=false
[/code]Is there in Outlook the opportunity like that???
Thank in advance. - AutorBeitrag
Du musst angemeldet sein, um auf dieses Thema antworten zu können.