Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Outlook 2007 Custom Forms

Posted on 2011-09-12
9
Medium Priority
?
474 Views
Last Modified: 2012-05-12
Hi,

I've had a look around and have researched this topic quite extensively, without much success.

I'm looking for a method that would enable our users to click on a button which would then either add in the phrase "<INS>" or would take the phrase out if it were already there.

I have tried using macros, but to no avail.

Hope somebody can help me out.
0
Comment
Question by:BowmanGilfillan
  • 5
  • 3
9 Comments
 
LVL 10

Expert Comment

by:Mohammed Rahman
ID: 36522853
Please elaborate. Where are we trying to add phrase or remove phrase (it it were already there).
0
 

Author Comment

by:BowmanGilfillan
ID: 36523066
sorry, in the subject line.

so what we need is basically an option like a checkbox or something that the user can select to say whether they want a banner to be suppressed.

Then if they want the banner to be suppressed coding needs to be done which will add the phrase "<INS>" to the subject line.

The mailserver will then process the rest.
0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 36523229
We still need more information.  Do you want this functionality in a message that is being composed (not yet sent), a message that has been received, or both?  Do you want the functionality to reside in the message form (that means a custom mail message, not an easy thing to implement), or can it be in a toolbar button (that is what I would recommend)?  Where in the body of the subject is the "<INS>" text to be inserted?
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 

Author Comment

by:BowmanGilfillan
ID: 36523275
Hi Guys,

Thanks for your patience.

It would be for messages that are being composed (so either new emails, replies or forwards).

It could be a toolbar button if that is easiest.

If it simply inserts the code into the subject line and removes the code if it is there, that's perfect.

The "<INS>" text would be inserted at the very beginning of the subject line.

hope i've managed to describe the issue correctly....
0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 36523377
The code below (Outlook VBA code, to be put in a standard module in your Outlook project, and possibly called from a toolbar button) adds "<INS>" to the end of the Subject line of the currently open mail message.  Similar code could be used to delete that string.
Public Sub AddTextToSubject()
'Created by Helen Feddema 12-Sep-2011
'Last modified by Helen Feddema 12-Sep-2011

On Error GoTo ErrorHandler

   Dim ins As Outlook.Inspector
   Dim msg As Outlook.MailItem
   Dim itm As Object
   Dim strBody As String
   
   Set ins = Application.ActiveInspector
   Set itm = ins.CurrentItem
   
   If itm.Class = olMail Then
      Set msg = ins.CurrentItem
      strBody = msg.Subject & " <INS>"
      msg.Subject = strBody
   End If
   
ErrorHandlerExit:
   Exit Sub

ErrorHandler:
   MsgBox "Error No: " & Err.Number _
      & " in AddTextToSubject procedure; " _
      & "Description: " & Err.Description
   Resume ErrorHandlerExit

End Sub

Open in new window

0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 36523397
Just saw your response -- to put the string at the beginning of line, just use this line:

strBody = "<INS> " & msg.Subject

To remove it, see below:
Public Sub RemoveTextFromSubject()
'Created by Helen Feddema 12-Sep-2011
'Last modified by Helen Feddema 12-Sep-2011

On Error GoTo ErrorHandler

   Dim ins As Outlook.Inspector
   Dim msg As Outlook.MailItem
   Dim itm As Object
   Dim strBody As String
   
   Set ins = Application.ActiveInspector
   Set itm = ins.CurrentItem
   
   If itm.Class = olMail Then
      Set msg = ins.CurrentItem
      strBody = msg.Subject
      If InStr(strBody, "<INS>") > 0 Then
         strBody = Replace(strBody, "<INS>", "")
      End If
      msg.Subject = strBody
   End If
   
ErrorHandlerExit:
   Exit Sub

ErrorHandler:
   MsgBox "Error No: " & Err.Number _
      & " in RemoveTextFromSubject procedure; " _
      & "Description: " & Err.Description
   Resume ErrorHandlerExit

End Sub

Open in new window

0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 36523416
If you want to get fancy, instead of two buttons (one to add and one to delete), you could pop up a dialog with options for adding or deleting, which would call the appropriate Sub procedure when selected.
0
 
LVL 31

Accepted Solution

by:
Helen Feddema earned 2000 total points
ID: 36523424
Or perhaps one procedure to look for the string, and remove it if found, or insert it if not found.
0
 

Author Comment

by:BowmanGilfillan
ID: 36523551
Hi,

Thanks so much.

This was very helpful.

It worked like a charm..

Again, thank you for all your help!!!!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Here in this article, you will get a step by step guidance on how to restore an Exchange database to a recovery database. Get a brief on Recovery Database and how it can be used to restore Exchange database in this section!
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
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: …
Suggested Courses
Course of the Month12 days, 12 hours left to enroll

971 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