I'm trying to create a macro in Outlook (thisOutlookSession) that checks the subject while I'm writing it, once I TAB and go to the email's body the macro has to check for subject and if subject is equal to a specific text then it opens a template. I've been able to write the part about the template, the difficult part is using the inspectors to check the subject while i'm writing it. Any solutions?
Forward the code:
Private Sub subject()
Dim subject As String
Dim item As Outlook.MailItem
Dim inspector As Outlook.inspector
Dim template As Outlook.MailItem
Set inspector = Outlook.ActiveInspector
Set item = inspector.CurrentItem
subject = item.subject
Debug.Print subject
If subject = "test" Then
Set template = Application.CreateItemFromTemplate("C:test\test.oft")
Display.template
Else
End If
End Sub