Outlook 2003... vba customizations

  • Thread starter Thread starter Colin
  • Start date Start date
C

Colin

Hi,

I would like to automate Outlook 2003 so that it asks after every
message I send if I want to flag that message for follow up and if I
want to set a reminder... how would I go about this?

I familiar with using advanced VBA in Access and Word but not Outlook.

Thank you,
Colin
 
Paste the following to ThisOutlookSession class module,
save. For this test, set your macro security to Medium
so that you have the option to enable macros. Unless you
have the ability to digitally sign your projects.

Then restart Outlook and compose and send a message.(be
sure to edit out line breaks):

Public WithEvents theInspectors As Outlook.Inspectors
Public WithEvents theMailItem As Outlook.MailItem

Private Sub Application_Startup()
Set theInspectors =
Outlook.Session.Application.Inspectors
End Sub

Private Sub Application_Quit()
Set theInspectors = Nothing
End Sub

Private Sub theInspectors_NewInspector(ByVal Inspector As
Outlook.Inspector)
If (TypeName(Inspector.CurrentItem) = "MailItem") Then
' Attach to events for current mail item.
Set theMailItem = Inspector.CurrentItem
End If
End Sub

Private Sub theMailItem_Close(Cancel As Boolean)
Set theMailItem = Nothing
End Sub

Private Sub theMailItem_Send(Cancel As Boolean)
Dim myItem As MailItem

Select Case MsgBox("Do you want to flag this mail
item for follow-up?", vbYesNoCancel, "Your Title")
Case vbYes
' Add code to flag for follow-up here.
' You can reference the message properties using
Set myItem = ActiveInspector.CurrentItem
'myItem.<property>
Debug.Print "Yes: flag for follow-up..."
Case vbNo
' Do nothing-- send will proceed.
Debug.Print "No: sending..."
Case vbCancel
Debug.Print "Cancel: canceling send..."
Cancel = True
End Select

Set myItem = Nothing
End Sub
 
Back
Top