?
Solved

Outlook form to modify subject line

Posted on 2015-01-19
8
Medium Priority
?
1,225 Views
Last Modified: 2015-01-26
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.
0
Comment
Question by:blkstrim
  • 3
  • 3
  • 2
8 Comments
 
LVL 37

Expert Comment

by:bbao
ID: 40559212
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.

https://www.add-in-express.com/creating-addins-blog/2013/04/24/creating-custom-outlook-forms/

this applies to Outlook 2007, 2010 and 2013.
0
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 40559898
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
    Item.Save
    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.
0
 

Author Comment

by:blkstrim
ID: 40560099
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
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 76

Expert Comment

by:David Lee
ID: 40560112
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.
0
 

Author Comment

by:blkstrim
ID: 40560117
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
0
 
LVL 76

Expert Comment

by:David Lee
ID: 40560163
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?
0
 
LVL 37

Expert Comment

by:bbao
ID: 40560964
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.
0
 

Author Closing Comment

by:blkstrim
ID: 40571128
thank you to all who helped with this question. This is exactly what I needed.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Steps to fix “Unable to mount database. (hr=0x80004005, ec=1108)”.
This article will help to fix the below errors for MS Exchange Server 2016 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
how to add IIS SMTP to handle application/Scanner relays into office 365.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses
Course of the Month16 days, 9 hours left to enroll

862 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