Solved

Outlook 2007 Custom Forms

Posted on 2011-09-12
9
466 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
Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

 

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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Find out what you should include to make the best professional email signature for your organization.
In this video we show how to create an Address List 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 Organization >> Ad…
To show how to generate a certificate request 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 Servers >> Certificates…

730 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