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

Outlook form to modify subject line

I need to create a outlook email form that will allow a user to type in a project number, then when the message is sent, append it to the subject line.

So, to be clear...
1. User starts new email and form pops up (this would replace the standard email form)
2.  Only difference in email form is that  before the Subject line, there is a line named Project #.
3. they type in a project number then fill out the subject and the body of the email and send normally.

When sent, the subject is modified to include the project number: Example: 110211 - Project update

Please let me know if this is possible.
  • 3
  • 3
  • 2
1 Solution
bbaoIT ConsultantCommented:
it is technically possible. what you do is to create a custom Outlook form using VBA for Outlook.

there is a good blog post giving great details about this. check below link.


this applies to Outlook 2007, 2010 and 2013.
David LeeCommented:
Hi, blkstrim.

As @bbao has already said, yes, this is possible.  All you need to do is

1.  Create the form  The link @bbao provided has details on how to do that.  In short, you'll create a new form based on the standard message form.  With that new form open in the form designer add your custom field to it.

2.  Add code (VBscript) behind the form to prepend the project number to the subject.  The code for that will look something like this.

Sub Item_Send()
    Dim olkIns, olkPag, olkCtl
    Set olkIns = Item.GetInspector
    Set olkPag = olkIns.ModifiedFormPages("Message")
    Set olkCtl = olkPag.Controls("txtProjNum")
    Item.Subject = olkCtl.Value & " " & item.Subject
    Set olkCtl = Nothing
    Set olkPag = Nothing
    Set olkIns = Nothing
End Sub

Open in new window

This code presumes that you named the control you'll enter the project number into "txtProjNum".  If you call it something else, then change "txtProjNum" to whatever name you use.  Note that the name cannot contain any spaces.  

3.  Once you've created the form and added the code you'll need to publish the form.  If you're going to be the only person using this form, then you can publish it to your personal forms library.  If there's a wider audience that needs to use the form, then you'll either need to publish it to each of their personal forms libararies or publish it to the organizational forms library.  The latter will probably require assistance from your email admin.
blkstrimAuthor Commented:
Hi, BlueDevilFan.

I created the form from the standard message form and added my textbox, which I named txtProjNum. I then added the code and published the form. The issue that I am having is the it is showing the same information in both the subject and Project number lines. When the message is sent, it is doubling the subject. Example:
I enter a Subject as: Testing
Tabbing or clicking to the Project # box, it is populated with Testing. If I add anything to it both the subject and Project # lines update and mirror each other.
When the message is sent, the Subject appears (using the sample above) as Testing Testing

How do I get around that. I know that it is simple and I am missing something easy. Just do not have the knowledge with Outlook forms to find it. I have also embedded a shot of the form.
Thanks for any additional help with this.
Outlook Form
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

David LeeCommented:
You must have connected the Project Number field to the Subject field.  Edit the properties of the Project Number field and tie it to a user-defined property instead.  You'll add that property.
blkstrimAuthor Commented:
I just figured out what I missed. You can disregard the last message. However, I do have one other question. When this form is used, and the email arrives, you can no longer see it in the Reading pane in Outlook. You see the following message: This item contains active content that cannot be displayed in the Reading Pane. Open the item to read its contents.
Of course, opening the message allows it to be seen. Is there are way to use the form and still see the message in the reading pane.

Thanks again
David LeeCommented:
No.  The reading pane only shows default Outlook form fields.  It will not show custom form fields.  That said, if the form is working properly and prepending the project number to the subject, then why would you also need to see the project number field in the reading pane?
bbaoIT ConsultantCommented:
why not simply populate the Proejct ID at the begining of the Subject field thus every one receiving the email can easily see the Project ID even they don't run Outlook to check the messages.

this will be espcially helpful when the message is received and/or forwarded by external parties such as the clients, contractors and suppliers.
blkstrimAuthor Commented:
thank you to all who helped with this question. This is exactly what I needed.
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

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

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