1

Mozilla Thunderbird has a function to give me a reminder in case I forget to enclose an attachment but use the word "attachment" (or other words, I can define my own list) in the e-mail text.

I've been looking for a similar function in Microsoft Outlook, but can't find it. Only a vague macro from a third party.

Does somebody know about a way to achieve this in Outlook?

waanders
  • 285
  • 2
  • 7
  • 21
  • Not natively, no. Not without a vague macro anyway. It's a setting I wanted years ago before I switched to Google Mail. –  May 16 '12 at 07:23

1 Answers1

2

I don't think there is any standard way. Here is another VBA macro which is more dynamic than the one you've already found by using regexp:

Option Explicit
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
   Dim regEx As New VBScript_RegExp_55.RegExp
   Dim Match, Matches
   Dim mail As MailItem
   
   ' Check if this is a mail
   If Not Item.Class = olMail Then Exit Sub
   
   Set mail = ActiveInspector.CurrentItem
       
   ' Check if the user forgot the attachment
   Set regEx = New RegExp
   regEx.IgnoreCase = True
   regEx.Global = True
   If mail.Attachments.Count = 0 Then ' no attachment
       Dim s As String
       s = mail.Body
       ' remove previous answers from the convesation (for Outlook 2003)
       If InStr(1, s, "_", vbTextCompare) <> 0 Then
           s = Mid(s, 1, InStr(1, s, "_", vbTextCompare))
       End If
       ' if the message is not in HTML
       If InStr(1, s, "-Message d'origine-", vbTextCompare) <> 0 Then
           s = Mid(s, 1, InStr(1, s, "-Message d'origine-", vbTextCompare))
       End If
       
       regEx.Pattern = "(^|^\w+)(attachment|joined|here is|document|linked)^\w+"
       Set Matches = regEx.Execute(s)
       If Matches.Count > 0 Then
           Cancel = MsgBox("VYou may have forgotten to join the attachment. Are you sure you want to send your mail ?", vbYesNo + vbExclamation, "Missing attachment!") = vbNo
       End If
   End If
End Sub

Note that you can translate every keyword to your current language.

Here are some documents explaining how to add a macro to Outlook:

You can also find some paid solutions.

Glorfindel
  • 4,089
  • 8
  • 24
  • 37
JMax
  • 3,195
  • 1
  • 22
  • 19
  • Sounds great, thank you very much for your code. Could you amend your answer just a little bit, how to use this code? How do I trigger outlook to use this macro every time I send an email? – Keks Dose Jan 14 '13 at 13:21