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
  • 293

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 = &quot;(^|^\w+)(attachment|joined|here is|document|linked)^\w+&quot;
   Set Matches = regEx.Execute(s)
   If Matches.Count &gt; 0 Then
       Cancel = MsgBox(&quot;VYou may have forgotten to join the attachment. Are you sure you want to send your mail ?&quot;, vbYesNo + vbExclamation, &quot;Missing attachment!&quot;) = 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,158
JMax
  • 3,205