' VBA program for Outlook, (c) Dan Evans. dan at danevans.co.uk ' Will check if your outgoing email mentions an attachment, but you've ' forgotten to attach it ' v1.03b of 29/7/05 - Modified by Leonard Slingerland (leonard at slingerland.biz) to have array of words rather than just one ' v1.03 of 10/8/04 - Modified to search through subject line as well as message body ' v1.02 of 16/10/02 - No change to code, but tested works with Outlook 2002 as well as Outlook 2000 ' v1.01 of 23/9/01 - OK for "Attach" as well as "attach" ' v1.00 of 21/9/01 - Initial working version Dim intRes As Integer Dim strMsg As String Dim strThismsg As String Dim intOldmsgstart As Integer ' ADDED BY LS >>> ' - Does not search for "Attach", but for all strings in an array that is defined here Dim sSearchStrings(3) As String Dim bFoundSearchstring As Boolean Dim i As Integer ' loop var for FOR-NEXT-loop bFoundSearchstring = False sSearchStrings(0) = "attach" sSearchStrings(1) = "hereby" sSearchStrings(2) = "bijlage" ' Dutch sSearchStrings(3) = "hierbij" ' Dutch ' ADDED BY LS <<< intOldmsgstart = InStr(Item.Body, "-----Original Message-----") ' intOldmsgstart is the location of where old/re/fwd msg starts. Will be 0 if new msg If intOldmsgstart = 0 Then strThismsg = Item.Body + " " + Item.Subject Else strThismsg = Left(Item.Body, intOldmsgstart) + " " + Item.Subject End If ' The above if/then/else will set strThismsg to be the text of this message only, ' excluding old/fwd/re msg ' IE if the original included message is mentioning an attachment, ignore that ' Also includes the subject line at the end of the strThismsg string ' ADDED BY LS >>> For i = LBound(sSearchStrings) To UBound(sSearchStrings) If InStr(LCase(strThismsg), sSearchStrings(i)) > 0 Then bFoundSearchstring = True Exit For End If Next i ' ADDED BY LS <<< If bFoundSearchstring Then If Item.Attachments.Count = 0 Then strMsg = "Dan Evans' Attachment Checker:" & Chr(13) & Chr(10) & "Your message mentions an attachment, but doesn't have one." & Chr(13) & Chr(10) & "Send the message anyway?" intRes = MsgBox(strMsg, vbYesNo + vbDefaultButton2 + vbExclamation, "You forgot the attachment!") If intRes = vbNo Then ' cancel send Cancel = True End If End If End If