PC Review


Reply
Thread Tools Rate Thread

Capture Message Body with the ItemSend Event

 
 
allan.awcs@gmail.com
Guest
Posts: n/a
 
      7th Sep 2007
I am using VS2005 and wish to record details of an e-mail send from my
app but I can't seem to update my form when the message is sent. I
have a simple form with one text box (txtMessage) and a button
(btnMail). Clicking btnMail fires up Outlook and when the message is
sent the ItemSend and Send events do fire but the do not allow me to
update my text box. The MsgBox do not display either but the do when i
comment out the txtMessage lines. What am I doing wrong??? It is as if
my form is not accessible programatically in the outlook event code. I
am using the following code:

Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports System.Data
Imports System.Data.Common
Imports Microsoft.Office.Interop.Outlook
Imports Microsoft.Office.Interop
Public Class frmMailTest
Dim WithEvents oApp As New Outlook.Application
Dim WithEvents oMsg As Outlook.MailItem
Private Sub btnMail_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnMail.Click
oMsg = oApp.CreateItem(OlItemType.olMailItem)
With oMsg
.To = "(E-Mail Removed)"
.Subject = "Subject"
.BodyFormat = OlBodyFormat.olFormatPlain
.Body = "Type your message here"
.Display()
End With
End Sub
Private Sub oApp_ItemSend(ByVal Item As Object, ByRef Cancel As
Boolean) Handles oApp.ItemSend
txtMessage.Text = Item.body.ToString
MsgBox("Mail Sent")
End Sub
Private Sub oMsg_Send(ByRef Cancel As Boolean) Handles oMsg.Send
txtMessage.Text = oMsg.Body.ToString
MsgBox("Mail Sent")
End Sub
End Class

 
Reply With Quote
 
 
 
 
Brian Tillman
Guest
Posts: n/a
 
      10th Sep 2007
(E-Mail Removed) <(E-Mail Removed)> wrote:

> I am using VS2005 and wish to record details of an e-mail send from my
> app but I can't seem to update my form when the message is sent. I
> have a simple form with one text box (txtMessage) and a button
> (btnMail). Clicking btnMail fires up Outlook and when the message is
> sent the ItemSend and Send events do fire but the do not allow me to
> update my text box. The MsgBox do not display either but the do when i
> comment out the txtMessage lines. What am I doing wrong??? It is as if
> my form is not accessible programatically in the outlook event code. I
> am using the following code:


Code questions are best discussed in microsoft.public.outlook.program_vba or
microsoft.public.outlook.program_addins
--
Brian Tillman [MVP-Outlook]

 
Reply With Quote
 
aj
Guest
Posts: n/a
 
      10th Sep 2007
On 10 Sep, 16:08, "Brian Tillman" <tillman1...@yahoo.com> wrote:
> allan.a...@gmail.com <allan.a...@gmail.com> wrote:
> > I am using VS2005 and wish to record details of an e-mail send from my
> > app but I can't seem to update my form when the message is sent. I
> > have a simple form with one text box (txtMessage) and a button
> > (btnMail). Clicking btnMail fires up Outlook and when the message is
> > sent the ItemSend and Send events do fire but the do not allow me to
> > update my text box. The MsgBox do not display either but the do when i
> > comment out the txtMessage lines. What am I doing wrong??? It is as if
> > my form is not accessible programatically in the outlook event code. I
> > am using the following code:

>
> Code questions are best discussed in microsoft.public.outlook.program_vba or
> microsoft.public.outlook.program_addins
> --
> Brian Tillman [MVP-Outlook]


Thanks - I will post there

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I capture the event ItemSend from a macro? Totem Microsoft Outlook VBA Programming 13 25th Apr 2008 02:05 PM
ItemSend Event Catalin Microsoft Outlook VBA Programming 4 17th Jan 2008 07:17 PM
Write RTF-Body on ItemSend event Thomas Microsoft Outlook Program Addins 2 12th Feb 2007 11:22 AM
Re: ItemSend Event =?Utf-8?B?U3VlIE1vc2hlciBbTVZQLU91dGxvb2td?= Microsoft Outlook VBA Programming 0 29th Jun 2004 03:05 AM
where to put to itemsend event and how to use it Raymond Microsoft Outlook VBA Programming 1 8th Jan 2004 01:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:58 PM.