Question : How to force rule to prevent colons in an email subject heading?

Hi,

We have a company email policy that asks users to organize their email by project. Each project has a code e.g: AAA:001.

Policy states that the email subject heading must start wtih the project code but without the colon: AAA001. If the user adds the colon, than the code gets truncated to just 001 for the reciever of the email.

Is there a way to prevent all users from sending an email with a colon in the subject heading?

Answer : How to force rule to prevent colons in an email subject heading?

Hi, occ_user.

This cannot be done with a rule.  Rules only fire when a message is received or after it's sent.  This requires a macro.  The macro is simple enough, but it will have to be deployed to every computer.  Outlook does not have an automated means of distributing macros.  Deploying the macro will have to be done manually.  The more computers there are in the organization the more of a pain this becomes.  Also, a savvy user could turn the macro off.

The above aside, here's the macro.  Follow these instructions to use it.

Outlook 2007
1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
4.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
5.  Edit the code as needed.  I included comment lines wherever something needs to or can change
6.  Click the diskette icon on the toolbar to save the changes
7.  Close the VB Editor
8.  Click Tools > Trust Center
9.  Click Macro Security
10. Set Macro Security to "Warnings for all macros"
11. Click OK
12. Close Outlook
13. Start Outlook.  Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.


Outlook 2003 and Earlier
1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
4.  Copy the code from the Code Snippet box and paste it into the right-hand pane of
5.  Outlook's VB Editor window
6.  Edit the code as needed.  I included comment lines wherever something needs to or can change
7.  Click the diskette icon on the toolbar to save the changes
8.  Close the VB Editor
9.  Click Tools > Macro > Security
10. Set the Security Level to Medium
11. Close Outlook
12. Start Outlook
13. Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.
1:
2:
3:
4:
5:
6:
7:
8:
9:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    If Item.Class = olMail Then
        If InStr(1, Item.Subject, ":") Then
            'Edit the warning message and title on the next line as needed.'
            msgbox "The subject contains a colon.  Please remove it and then send again.", vbCritical + vbOKOnly, "Company Policy"
            Cancel = True
        End If
    End If
End Sub
Random Solutions  
 
programming4us programming4us