Hi,

I'm new to VBA and I've tried to create code that before sending an e-mail with an attachment, a message box appears asking if the attachment has been checked before sending.

This worked on the day it was implemented, but after restarting my PC, the code is still visible in ThisOutlookSession but does not run.

Is there something I need to do in order for this to run each day?

I also want to advance this to only run this if the attachment/s are specific attachment types, not sure if this is possible or not.

Any help is appreciated.



Code below:

'ThisOutlookSession
Option Explicit
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
  Dim msg As String
  Dim att As Outlook.Attachment
    
  If TypeOf Item Is Outlook.MailItem Then
    If Item.Attachments.Count > 0 Then
      msg = "Have you double checked the attachment/s to ensure that the data is relevant?." & vbNewLine & _
            "If no, please press the No button and re-check." & vbNewLine
      For Each att In Item.Attachments
        msg = msg & vbNewLine & "* " & att.FileName
      Next
      If MsgBox(msg, vbQuestion + vbSystemModal + vbYesNo) = vbNo Then Cancel = True
    End If
  End If
End Sub