• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1657
  • Last Modified:

Special option to auto populate subject line in Outlook 2003

We received a request for a feature in Outlook we have never seen before. Look at the request below and see if there is a feature, 3rd party software or a work around we are unaware of:


With respect to the concept of being able to identify e-mails that are attorney-client privileged, business records, or non-business records, perhaps we can use some buttons in Outlook that would automatically populate the subject line of new e-mails with intro info like ATTORNEY-CLIENT PRIVILEGE: or BUSINESS RECORD: or PERSONAL: etc.  We did something like this at my old company, after a new document classification system was put in place requiring each document to be labeled as Internal Use Only, Confidential, or Restricted.  Buttons were installed on Outlook that would be clicked to begin an e-mail, replacing the New selection with three or four options to get the message started.  So the subject line would say, for example, CONFIDENTIAL: and then the author would fill in the subject of the message after this text.  

Any help appreciated,
  • 4
  • 4
1 Solution
David LeeCommented:
Hi, John.

Yes, this is possible by developing an Outlook add-in or a bit of scripting.  Add-ins are easier to deploy, but require additional tools and more programming effort.  Scripting is easier to write, but harder to deploy.  Forgetting about the delivery method, the code would add the buttons to the toolbar and handle the button's click event to create the chosen message.  If you want to enforce the text in the subject line, then you'll also need either a custom outlook form for each message type, or add code that checks messages before they are sent and restores the subject line text if it's been changed or removed.  The latter approach is simpler.  I can help with putting a script together that does this.  
JohnMac328Author Commented:
That sounds like what they want, any help is greatly appreciated.
David LeeCommented:
The solution comes in two parts.  This is part 1.  Follow these instructions to use it.

1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects
4.  If not already expanded, expand Modules
5.  Select an existing module (e.g. Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert > Module.
6.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
7.  Edit the code as needed.  I included comments wherever something needs to or can change
8.  Click the diskette icon on the toolbar to save the changes
9.  Close the VB Editor

Sub New_ACP_Msg()
    NewMessage "ACP"
End Sub
Sub New_BR_Msg()
    NewMessage "BR"
End Sub
Sub New_Personal_Msg()
    NewMessage "PERS"
End Sub
Sub New_Confidential_Msg()
    NewMessage "CONF"
End Sub
Sub NewMessage(strMsgType As String)
    Dim olkMsg As Outlook.MailItem
    Set olkMsg = Outlook.Application.CreateItem(olMailItem)
    Select Case strMsgType
        Case "ACP"
            olkMsg.Subject = "ATTORNEY-CLIENT PRIVILEGE: "
        Case "BR"
            olkMsg.Subject = "BUSINESS RECORD: "
        Case "PERS"
            olkMsg.Subject = "PERSONAL: "
            olkMsg.Sensitivity = olPersonal
        Case "CONF"
            olkMsg.Subject = "CONFIDENTIAL: "
            olkMsg.Sensitivity = olConfidential
    End Select
    Set olkMsg = Nothing
End Sub

Open in new window

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

David LeeCommented:
This is part 2.  Follow these instructions to use it.

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.

Private Sub Application_Startup()
    Dim ofcToolbar As Office.CommandBar, _
        ofcAddButton As Office.CommandBarPopup, _
        ofcBtn1 As Office.CommandBarButton, _
        ofcBtn2 As Office.CommandBarButton, _
        ofcBtn3 As Office.CommandBarButton, _
        ofcBtn4 As Office.CommandBarButton
    Set ofcToolbar = Outlook.Application.ActiveExplorer.CommandBars("Standard")
    Set ofcAddButton = ofcToolbar.Controls.Item(1)
    'Add the first button'
    Set ofcBtn1 = ofcAddButton.Controls.Add(msoControlButton, , , 2)
    With ofcBtn1
        .Style = msoButtonAutomatic
        .Caption = "Attorney-Client Privilege Message"
        .FaceId = 1757
        .OnAction = "New_ACP_Msg"
    End With
    'Add the second button'
    Set ofcBtn2 = ofcAddButton.Controls.Add(msoControlButton, , , 3)
    With ofcBtn2
        .Style = msoButtonAutomatic
        .Caption = "Business Record Message"
        .FaceId = 1757
        .OnAction = "New_BR_Msg"
    End With
    'Add the third button'
    Set ofcBtn3 = ofcAddButton.Controls.Add(msoControlButton, , , 4)
    With ofcBtn3
        .Style = msoButtonAutomatic
        .Caption = "Confidential Message"
        .FaceId = 1757
        .OnAction = "New_Confidential_Msg"
    End With
    'Add the fourth button'
    Set ofcBtn4 = ofcAddButton.Controls.Add(msoControlButton, , , 5)
    With ofcBtn4
        .Style = msoButtonAutomatic
        .Caption = "Private Message"
        .FaceId = 1757
        .OnAction = "New_Personal_Msg"
    End With
    Set ofcToolbar = Nothing
    Set ofcAddButton = Nothing
    Set ofcBtn1 = Nothing
    Set ofcBtn2 = Nothing
    Set ofcBtn3 = Nothing
    Set ofcBtn4 = Nothing
End Sub

Open in new window

JohnMac328Author Commented:
Almost there, now how do I add the buttons?  When I go to Tools-Customize-Toolbars, under Macros I don't have anything showing.  I did click on enable macros when I restarted Outlook.
JohnMac328Author Commented:
Sorry, that was me.  Thanks
JohnMac328Author Commented:
Thanks for the help
David LeeCommented:
You're welcome.  Glad I could help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now