Solved

Outlook 2007 Custom Forms

Posted on 2011-09-12
9
462 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
 

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

Join & Write a Comment

Suggested Solutions

Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
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…
In this video we show how to create a Distribution Group in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >>…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

757 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

20 Experts available now in Live!

Get 1:1 Help Now