rattanjits
Member
The Outlook developer reference for MailItem.Close event includes the following example to save an item without prompting the user:
Public WithEvents myItem As Outlook.MailItem
Public Sub Initalize_Handler()
Set myItem = Application.ActiveInspector.CurrentItem
End Sub
Private Sub myItem_Close(Cancel As Boolean)
If Not myItem.Saved Then myItem.Save
End Sub
I copied the example into Thisoutlooksession - and editted and closed a message - but it did not run. I have no knowledge of using Outlook events (other than events in the Application class which run automatically). Please advise.
Public WithEvents myItem As Outlook.MailItem
Public Sub Initalize_Handler()
Set myItem = Application.ActiveInspector.CurrentItem
End Sub
Private Sub myItem_Close(Cancel As Boolean)
If Not myItem.Saved Then myItem.Save
End Sub
I copied the example into Thisoutlooksession - and editted and closed a message - but it did not run. I have no knowledge of using Outlook events (other than events in the Application class which run automatically). Please advise.