Link to home
Start Free TrialLog in
Avatar of NoPainNoGain
NoPainNoGain

asked on

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

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?
Avatar of David Lee
David Lee
Flag of United States of America image

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.
Avatar of NoPainNoGain
NoPainNoGain

ASKER

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!
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 VB.net version.  If you feel more comfortable with a professional product, then there's Add-in Express (http://www.add-in-express.com/).

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.
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!  :)
No problem.

Not sure.  No harm in trying.

Sure.  Here's the link: http://www.microeye.com/resources/code.htm  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.  :-)
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 http://msdn.microsoft.com/en-us/library/cc668191.aspx
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
                Next
 
                '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

ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial