Wednesday, May 03, 2006

Outlook 2003 - Warn if subject line is empty

This is my adaptation of the code found at: http://notepadexe.blogspot.com/2005/07/outlook-2003-warn-if-subject-line-is.html
  1. Go to the menu Tools → Macro → Visual Basic Editor.
  2. Now in the Visual Basic Editor, you should see Project1 in the tree menu on the left. Drill down the tree to Project1 → Microsoft Office Outlook → ThisOutlookSession.
  3. In the code area (the big text area on the right) paste in the following code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
  If TypeName(Item) <> "MailItem" Then
    Exit Sub
  End If
  'CHECK FOR BLANK SUBJECT LINE
  If Item.Subject = "" Then
    Cancel = MsgBox("This message has no subject." & vbNewLine & _
                      "Do you wish to send anyway?", _
                      vbMsgBoxSetForeground + vbYesNo + vbExclamation, _
                      "No Subject") = vbNo
    If Cancel Then
      Dim myInspector As Outlook.Inspector
      Set myInspector = Item.GetInspector
      myInspector.Activate
    End If
  End If
End Sub

Notepad . exe: Outlook 2003 - Warn if subject line is empty

Notepad . exe: Outlook 2003 - Warn if subject line is empty