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

How to insert text in subject line of existing message

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
mradicke
Asked:
mradicke
  • 5
  • 4
1 Solution
 
Chris BottomleyCommented:
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
 
mradickeAuthor Commented:
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
 
Chris BottomleyCommented:
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
mradickeAuthor Commented:
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
 
Chris BottomleyCommented:
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
 
Chris BottomleyCommented:
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
 
mradickeAuthor Commented:
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
 
mradickeAuthor Commented:
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
 
mradickeAuthor Commented:
This assistance was invaluable to me, especially since it was provided quickly and customized to my needs.  Thanks!
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

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