![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#3
|
|||
|
|||
![]()
Is there any way to force that posting in code so as to accept whatever
text has been keyed? Thanks, Glen Ken Slovak - [MVP - Outlook] wrote: The control doesn't post the text until it loses focus. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm wrote in message ups.com... I have run across a strange problem. I have created a simple Outlook 2003 Add-in using VSTO in VS2005. When a new mail message inspector is opened, I add a button to the inspector's command bar. This button simply appends some standard text on the end of whatever subject line text is already there if it has not already been done. I check to see if the standardized text is on the end of subject. If it's not, I add it. It's really rather simple and works great (even with multiple inspectors open) except for one strange issue. When I enter some text in the subject line, if I DON'T exit the subject textbox, whatever text I've entered doesn't show up in the mail message object. So, when I go to add the standard text, whatever text I've already keyed isn't there and my code erases it when it resets the subject textbox. If I key in some text and EXIT the subject textbox, then, when I click the button, the mail object sees the text just fine and appends the standard text to it as it should. Has anyone else seen this behavior? It seems that the text in the subject line textbox is not available to the mail message object until you exit the field. Any help or information would be greatly appreciated. Sincerely, Glen Wolinsky Code Below --------------------------- Public Class ThisApplication Const PRIV_TEXT As String = " - Confidential Attorney Work Product - Subject to Privilege" Private WithEvents confidentialButton As Office.CommandBarButton Private WithEvents olInspectors As Outlook.Inspectors = Me.Inspectors Private Sub ThisApplication_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup End Sub Private Sub ThisApplication_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown End Sub Private Sub NewInspector(ByVal insp As Outlook.Inspector) Handles olInspectors.NewInspector If TypeOf (insp.CurrentItem) Is Outlook.MailItem Then Dim bar As Office.CommandBar = insp.CommandBars("Standard") confidentialButton = bar.Controls.Add(Office.MsoControlType.msoControlB utton, Temporary:=True) With confidentialButton .Caption = "Privilaged Tag" .Style = MsoButtonStyle.msoButtonCaption AddHandler .Click, AddressOf confidentialButton_Click End With End If End Sub Private Sub confidentialButton_Click(ByVal Ctrl As Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean) Dim draft As Outlook.MailItem = DirectCast(ActiveInspector.CurrentItem, Outlook.MailItem) If Not draft.Subject.EndsWith(PRIV_TEXT) Then draft.Subject = Trim(draft.Subject) & PRIV_TEXT End If End Sub End Class |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Office 2003 strange behavior | Beauford | Outlook - General Queries | 5 | August 1st 06 09:33 PM |
Address book, strange behavior | shanej2015@yahoo.com | Outlook and VBA | 4 | May 26th 06 10:56 PM |
Strange calendar behavior | Dan | Outlook - Calandaring | 1 | February 25th 06 04:12 AM |
Strange characters on Subject Line. | ferg | Outlook - General Queries | 9 | February 24th 06 06:09 PM |
strange encryption behavior | Larry | Outlook - General Queries | 0 | January 24th 06 09:26 PM |