Solved

How to insert text in subject line of existing message

Posted on 2011-02-22
9
613 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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
 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
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: …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

726 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