Skip to content

Instantly share code, notes, and snippets.

@gioxx
Created January 21, 2022 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gioxx/1c025fd9dc48456cded1388a74a45f9c to your computer and use it in GitHub Desktop.
Save gioxx/1c025fd9dc48456cded1388a74a45f9c to your computer and use it in GitHub Desktop.
Dedicato a chi dimentica di allegare i file prima di mandare un'email. Testato con successo su Outlook 2016 (16.0.14326.20706)
' Outlook 2016: Attachment Reminder
' -----------------------------------------------------------------------------------------------------------
' Author: GSolone
' Version: 0.1
' Last modified: 21-01-2022
' Credits: https://www.slipstick.com/outlook/email/attachment-missing-from-outlook-message/
' https://stackoverflow.com/questions/40934390/how-to-check-for-attachment-when-sending-an-email
' ------------------------------------------------------------------------------------------------------------
' UPDATES:
' -
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim vList As Variant
Dim i As Integer
wList = Array("attached", "attachment", "allego", "allegato", "allegata", "allegati")
For i = 0 To UBound(wList)
If InStr(1, Item.Body, LCase(wList(i)), vbTextCompare) > 0 Then
answer = MsgBox("Non trovo allegati in questa email, la mando comunque?", vbYesNo + vbQuestion, "Attachment Reminder")
If answer = vbNo Then Cancel = True
Exit Sub
End If
Next i
If Item.Attachments.Count > 0 Then
For Each oAtt In Item.Attachments
Debug.Print oAtt.Size
If oAtt.Size < 5200 Then
GoTo NextAtt
Else
answer = MsgBox("Non trovo allegati in questa email, la mando comunque?", vbYesNo + vbQuestion, "Attachment Reminder")
If answer = vbNo Then Cancel = True
End If
NextAtt:
Next oAtt
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment