View Single Post
  #3  
Old May 31st 12, 06:56 PM
NDuarte NDuarte is offline
Junior Member
 
First recorded activity at Outlookbanter: May 2012
Posts: 6
Default

There is a way to do this. There is a great article http://blogs.officezealot.com/legault/pages/20086.aspx that explains in detail, but here is the general idea:

- Open VBA (Alt-F11) and open "ThisOutlookSession"
- Put in the following code:
Code:
  Option Explicit

  Dim myMailItemTrapper As clsMailItemTrapper
 
  Private Sub Application_Startup()

    Set myMailItemTrapper = New clsMailItemTrapper

  End Sub

  Private Sub Application_Quit()

    Set myMailItemTrapper = Nothing

  End Sub
- Click Insert - Class Module and rename it to clsMailItemTrapper

- In the new class, put in the following:
Code:
  Option Explicit

  Dim WithEvents objInspectors As Outlook.Inspectors

  Dim WithEvents objOpenInspector As Outlook.Inspector

  Dim WithEvents objMailItem As Outlook.MailItem

  Private Sub Class_Initialize()

    Set objInspectors = Application.Inspectors

  End Sub

  Private Sub Class_Terminate()

    Set objOpenInspector = Nothing

    Set objInspectors = Nothing

    Set objMailItem = Nothing

  End Sub 

  Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)

    If Inspector.CurrentItem.Class = olMail Then

      Set objMailItem = Inspector.CurrentItem

      Set objOpenInspector = Inspector

    End If

  End Sub

  Private Sub objMailItem_Open(Cancel As Boolean)

    objMailItem.Subject = "Put your subject here"

  End Sub
- Save the VBA code and restart Outlook. Anytime someone pressed the "New E-Mail" button, the subject will automatically be populated.

As I said, check out that site for more details as you can just about do anything you need to.

Last edited by NDuarte : May 31st 12 at 10:34 PM. Reason: Added Code Tags
Ads