Avatar of finance_teacher
finance_teacher
 asked on

Outlook -- Macro Installer ?

Does someone have an installer (.exe, etc) so I don't have to tell users to do the below ?
---------------------
Current Steps
 1. Open Outlook
 2. click "Tools"
 3. click "Macro"
 4. click "Visual Basic Editor"
 5. paste below
 6. save
---------------------
Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim arrWords As Variant
Dim strWord As Variant
Dim intResponse As Integer
Dim lngSigStart As Long
Dim lngWordStart As Long
Dim sigblockidentifier As String
'    toMe item
   
    sigblockidentifier = "" ' A block of text that signifies the start of the sig block
    arrWords = Array("enclosed", "attach", "attached", "attachment")
    If sigblockidentifier <> "" Then
        lngSigStart = InStr(1, Item.Body, sigblockidentifier, vbTextCompare)
    End If
    If lngSigStart = 0 Then lngSigStart = 1000000
    Select Case Item.Class
        Case olMail ', olMeetingRequest, olTaskRequest
            If Item.Sent = False Then
                For Each strWord In arrWords
                    lngWordStart = InStr(1, LCase(Item.Body), strWord)
                    If lngWordStart > 0 And lngWordStart < lngSigStart Then
                        If Item.Attachments.Count = 0 Then
                            intResponse = MsgBox("Did you forget to attach something?  I " & _
                                "found the word '" & strWord & "'" & Chr(10) & "in your " & _
                                "message, but there is no attachment." & Chr(10) & Chr(10) & _
                                "Click Yes to stop the mail and add an attachment.", _
                                vbYesNo + vbExclamation, "Attachment Check")
   
                            If intResponse = vbYes Then
                                Item.GetInspector.CommandBars.FindControl(msoControlButton, 1079).Execute
                                Exit For
                            End If
                        End If
                        Exit For
                    End If
                Next
               
                ' Check for blank subject
                If Trim(Item.Subject) = "" Then
                    intResponse = MsgBox("You did not put in a subject.  Send anyway?", _
                        vbInformation + vbYesNo, "Subject Check")
                    If intResponse <> vbYes Then Cancel = True
                End If
            End If
    End Select
End Sub
.NET ProgrammingOutlook

Avatar of undefined
Last Comment
David Lee

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
David Lee

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23