Solved

How to insert text in subject line of existing message

Posted on 2011-02-22
9
607 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA & VBSCRIPT: re-adapt log file 13 26
Windows 7 Professional 6 61
Outlook sent emails not present in sent items 2 25
outlook 6 40
Find out what you should include to make the best professional email signature for your organization.
When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
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 Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

777 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