Solved

Outlook 2007 Custom Forms

Posted on 2011-09-12
9
467 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
[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
  • 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. 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 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

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

734 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