Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Outlook 2007 Custom Forms

Posted on 2011-09-12
9
Medium Priority
?
476 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

Question has a verified solution.

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

Exchange administrators are always vigilant about Exchange crashes and disasters that are possible any time. It is quite essential to identify the symptoms of a possible Exchange issue and be prepared with a proper recovery plan. There are multiple…
As a Microsoft Exchange user, you must have known the importance of an Offline storage table (OST) file. It is nothing new for an Outlook user to be dependent on a .ost file during a server break down or a problematic Internet connection. In such a…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month10 days, 21 hours left to enroll

572 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