Outlook Macro Secuirty, how do I sign a macro to distribute to hundreds of users so they don't receive a secuirty prompt?

Posted on 2009-02-09
Last Modified: 2012-05-06
I have written an Outlook Macro and need to distribute to 300 people that have various Macro Settings.  I want to sign the macro so it is trusted and they are not prompted about using it.
Selfcert.exe only works on local pc and I don't want to lower security lower than medium level.
Any Idea how to accomplish this?
Question by:NoPainNoGain
    LVL 76

    Expert Comment

    by:David Lee
    Hi, NoPainNoGain.

    That's a problem.  Actually it's two problems.  First, there is no good method for distributing Outlook macros.  Microsoft apparently envisioned them as single user only solutions which would never be shared or distributed.  The only way to share them is to send the source code and let folks manually add it to Outlook, or copy the entire macro file (VbaProject.OTM) and overwrite each user's existing macro file.  The problem with the latter is that it's destructive.  If the user has any macros, then they'd lose them when their file is overwritten.  Microsoft's solution for sharing code is the Outlook add-in.  These are written in VB or C and compiled into a DLL which can then be shared easily.  Add-ins also have different security rules.  

    As to signing the code, there is no way I know of to centrally sign and distribute an Outlook macro.  It might be possible if you have a certificate from a certificate provider like Verisign and you distributed the .OTM file.  I'm not certain of that though.  If you have access to VB, then for a 300 computer installation I'd recommend using an add-in.  I can point you to an add-in template if you're interested in going that route and can use VB.

    Author Comment

    Hi BlueDevilFan,
    Yes, the method I was hoping to deploy was trying to copy the OTM file to the PC's.  The users shouldn't have any of their own Macro's in place.  To be safe I could always have the logon script save the existing OTM file on the PC.  I'm not sure what is involved with a provider like Verisign either, or how much it costs.
    How complex is the Add-In creation process?  What version of VB will I need to have?  How could I deploy the Add in to all the users?
    Thanks for the help!
    LVL 76

    Expert Comment

    by:David Lee
    The add-in creation process is pretty simple if you use a template.  All you have to do is edit the template and add your code.  The add-ins I've done all use VB6, but I think the same person that did the VB6 template I use has also posted a version.  If you feel more comfortable with a professional product, then there's Add-in Express (

    Deploying an add-in is pretty simple too.  I don't remember the exact steps, it's been awhile since I deployed one, but it's something along the line of dropping the resulting DLL on the target computers and registering it.

    Author Comment

    Sorry for the delay in response.
    I believe I have an old copy of VB 5.0 at home...would the template work with that?
    Could you provide the template or point me in the right direction?
    Again,your help is very much appreciated.
    Good luck with the big game tonight BlueDevilFan!  :)
    LVL 76

    Expert Comment

    by:David Lee
    No problem.

    Not sure.  No harm in trying.

    Sure.  Here's the link:  Don't be put off because the page says the template is for Outlook 2000 and 2002.  It works fine with 2003.

    No problem.  Happy to contribute.

    Thanks.  It didn't go well, but I appreciate the thought.  :-)

    Author Comment

    I have gotten a copy of Visual Studio 2008, with VB 2008 on it.  There is a template included. So using your idea I google for VS2008 Outlook Add-In template and have found
    I have copied the code over (see attached)  and tried to follow the directions.   I test locally and it seems to work fine.  Then I get lost.   I have tried to "build solution" and then publish it.   It publishes to a directory and copies files in and includes a setup file.
    I then go to another PC, click the setup, it installs .net framework 3.5, and then project I created.  However it just doesn't do anything when testing.   Do you have any idea if I'm missing something??
    PS... I'm a Hoya fan (living in NY)...we went from #8 in the country to not even making the tournament in about 3 weeks.   So don't complain!  

    Public Class ThisAddIn
        Private WithEvents inspectors As Outlook.Inspectors
    Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
            inspectors = Me.Application.Inspectors
        End Sub
        Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
        End Sub
        Private Sub Application_ItemSend(ByVal Item As Object, ByRef Cancel As Boolean) Handles Application.ItemSend
            Dim prompt As String
            Dim myInspector As Outlook.Inspector
            Dim myItem As Outlook.MailItem
            Dim myAttachments As Outlook.Attachments
            Dim ExtEmailAddress As Boolean
            Dim Totalrecipients As Integer
            Dim Count As Integer
            myInspector = Application.ActiveInspector
            ExtEmailAddress = False
            If Not TypeName(myInspector) = "Nothing" Then
                If TypeName(myInspector.CurrentItem) = "MailItem" Then
                    myItem = myInspector.CurrentItem
                    myAttachments = myItem.Attachments
                    'Check for an external email address (if an smpt format then external)
                    Totalrecipients = myItem.Recipients.Count
                    For Count = 1 To Totalrecipients
                        If InStr(myItem.Recipients.Item(Count).Address, "@") Then
                            ExtEmailAddress = True
                        End If
                    'If there are attachments and an external email address exists then prompt the user
                    If myAttachments.Count > 0 And ExtEmailAddress = True Then
                        prompt = "Please confirm the recipients before sending this email." & vbCrLf & vbCrLf & myItem.To & vbCrLf & vbCrLf & "Are you sure you want to send " & myAttachments.Count & " documents to these recipients?"
                        If MsgBox(prompt, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Warning: ") = vbNo Then
                            Cancel = True
                        End If
                    End If
                End If
            End If
        End Sub
    End Class

    Open in new window

    LVL 76

    Accepted Solution

    Sorry, I'm not familiar enough with .Net to be able to offer any advice on what has to be when using it.  I do have VS2005, but have not taken the time to learn very much about using it.  I still use VB6 for anything serious.  

    Ouch.  Yeah, I know they had a meltdown after having a good start including winning a couple of big games (Syracuse and UConn I think).  I always hate to see that.  

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Learn more about the importance of email disclaimers with our top 10 email disclaimer DOs and DON’Ts.
    Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now