Home > Uncategorized > Outlook macros: what.

Outlook macros: what.

I had a request to make Outlook do something after an email is sent.

Here’s how you do that (I’m not too exciting this morning):

Public WithEvents myOlApp As Outlook.Application
Private Sub Application_Startup()
    Call Initialize_handler
End Sub
Public Sub Initialize_handler()
 Set myOlApp = Outlook.Application
 MsgBox ("I be loading")
End Sub
Private Sub myOlApp_ItemSend(ByVal Item As Object, Cancel As Boolean)
 Dim prompt As String
 prompt = "Are you sure you want to send " & Item.Subject & "?"
 If MsgBox(prompt, vbYesNo + vbQuestion, "Sample") = vbNo Then
 Cancel = True
 End If
End Sub

Pop up the developers tab on your ribbon, and insert that code into the “ThisOutlookSession.” Save. Close and reopen. Macro security is important.

If we move this into production, I’ll work on signing the macro also.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: