Solved

How to insert text in subject line of existing message

Posted on 2011-02-22
9
603 Views
Last Modified: 2012-05-11
I need to allow users to append text to the subject line of an existing message before sending it by executing a macro item through the menu.  I can handle the menu part, and I can insert the text in the subject line all day long in NEW messages, but what it the user already has the message open and wants to add the text to the existing subject line?  Not a reply or a forward, a message the user just created.  

I found a similar thread here:  http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_24329884.html  But in my case the users do not want to decide on the text they'll add until AFTER they've created a new message and populated all the fields.  So the macro needs to work on an existing, unsent message, from anywhere within the message, and append the text to the existing subject line.

Anyone have any code for that?  Thanks.  M
0
Comment
Question by:mradicke
  • 5
  • 4
9 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34960161
Are you looking for application.activeinspector which would be the current selection for the opened item

application.ActiveInspector.CurrentItem.subject = application.ActiveInspector.CurrentItem.subject & "Fred"

Chris
0
 

Author Comment

by:mradicke
ID: 34966242
Yes, that's what I'm looking for, but I have no idea how to write the rest of the code--the declarations, etc.  I'm a newbie.  Thanks!
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34967474
The code line does it of course but ...

Can you talk over the process, for example is the text addition fixed or a dynamic and how do you want it triggering.

Chris
0
 

Author Comment

by:mradicke
ID: 34967517
I plan to to have several options, each triggered by separate macros, and use buttons for each.  The text for each will be fixed.  The use for these is to indicate which signature is to be appended to the message as it passes through the Exchange server.  My users are having difficulty remembering or accurately typing the various options, which are "no_sig", "short_sig", "tax_disclaimer", and "name_only", and this results in the incorrect signature being appended to messages, and misspellings or errors also result in this random text being left in the subject line (the tags are taken off at the same time that the signature is added, at the server level).  Embarrassing to the users, if nothing more.    I was able to provide a means for creating a new message with the text in the subject line, but users became confused and deleted or altered or typed over the text tag.  Or they changed their minds before sending the message and tried to change it with mixed results.   So I think the best solution is to have buttons for each of the choices so they can make the selection, verify they've made the right selection, and then send the message.

To be clear, what I'm trying to do is simply provide a macro that inserts specific text at the end of the subject line of a message that's already been created, and this may actually be a reply, replyall, or forward, if that matters, or it may be a newly created message.   I've just never written much VBS code and I can't seem to make this work.  Thanks!
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 125 total points
ID: 34967581
Okay then your button needs to call a sub and that sub needs to sit in a normal code module:  

To Create a macro:
------------------

Alt + F11 to open the macro editor

  For User Code:
     Insert | Module to insert a code module into the project
     In the project tree select the module.
     Insert the required macro(s) into the selected module, ('Module1' or similar)

The button code will look a bit like:

Chris
Sub button1_Action()
    If Application.Inspectors.count = 0 Then Exit Sub
    If Application.ActiveInspector.CurrentItem.Class <> olMail Then Exit Sub
    Application.ActiveInspector.CurrentItem.Subject = Application.ActiveInspector.CurrentItem.Subject & "Fred"
End Sub


Sub button2_Action()
    If Application.Inspectors.count = 0 Then Exit Sub
    If Application.ActiveInspector.CurrentItem.Class <> olMail Then Exit Sub
    Application.ActiveInspector.CurrentItem.Subject = Application.ActiveInspector.CurrentItem.Subject & "Doris"
End Sub

Open in new window

0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34967590
Note there is a way to make a context button from which you could select the insertion ... but if you are a newbie that might be a step too far as in 2003 it is more involved to implement.

Chris
0
 

Author Comment

by:mradicke
ID: 34967623
Thanks, Chris, I will try this in the morning--bout done for the nite.  Looks like what I need, though.  

As for a context button, that won't really work for my needs.  These selections will be purely subjective, user by user. And as you say, it might be a bit more than I want to bite off anyway.  This actually looks perfect.  Will let you know if it works.  Thanks again.  M
0
 

Author Comment

by:mradicke
ID: 34975472
This worked, Chris.  Once I had you code it took me less than a half hour to modify it, install it, add the buttons and fully test it.  I'm ready to roll it out.  You're a lifesaver!   Thanks so much!  M
0
 

Author Closing Comment

by:mradicke
ID: 34975482
This assistance was invaluable to me, especially since it was provided quickly and customized to my needs.  Thanks!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Outlook Free & Paid Tools
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now