A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

application item send



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 10th 08, 01:38 AM posted to microsoft.public.outlook.program_addins
SOPHIE
external usenet poster
 
Posts: 21
Default application item send

hi,
I want to code a small project which can pop up a warning when user click
send a email.
But it doesnt work for application_itemsend.
i work with VS2008, vb.

the code is here.

Public Class ThisAddIn
Public WithEvents myOlApp As Outlook.Application
Event ItemSend As AssemblyLoadEventHandler


Public Sub Initialize_handler()
myOlApp = CreateObject("Outlook.Application")
End Sub


Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Startup
Initialize_handler()
End Sub

Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Shutdown

End Sub

Private Sub myOlAppEvents_ItemSend(ByVal Item As Object, ByVal Cancel As
Boolean)
Dim prompt As String
prompt = "Are you sure you want to send " & Item.Subject & "?"
If MsgBox(prompt, vbYesNo + vbQuestion, "Sample") = vbNo Then
Cancel = True
End If

End Sub

End Class

Any help is appreciated.
Ads
  #2  
Old November 10th 08, 02:44 AM posted to microsoft.public.outlook.program_addins
SOPHIE
external usenet poster
 
Posts: 21
Default application item send

i cannot capture itemsend event. I can capture the event in visual Basic 6.0
in the same way. but i cant get it here in vb studio 2008. I dont know why.

"sophie" wrote:

hi,
I want to code a small project which can pop up a warning when user click
send a email.
But it doesnt work for application_itemsend.
i work with VS2008, vb.

the code is here.

Public Class ThisAddIn
Public WithEvents myOlApp As Outlook.Application
Event ItemSend As AssemblyLoadEventHandler


Public Sub Initialize_handler()
myOlApp = CreateObject("Outlook.Application")
End Sub


Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Startup
Initialize_handler()
End Sub

Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Shutdown

End Sub

Private Sub myOlAppEvents_ItemSend(ByVal Item As Object, ByVal Cancel As
Boolean)
Dim prompt As String
prompt = "Are you sure you want to send " & Item.Subject & "?"
If MsgBox(prompt, vbYesNo + vbQuestion, "Sample") = vbNo Then
Cancel = True
End If

End Sub

End Class

Any help is appreciated.

  #3  
Old November 10th 08, 02:26 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default application item send

In a VSTO addin you should never use CreateObject to instantiate an
Outlook.Application object. Instead in the Startup event do this:

myOlApp = Me.Application


Also, change your declaration of the ItemSend event handler to this:

Private Sub myOlApp_ItemSend(ByVal Item As Object, _
ByVal Cancel As Boolean) Handles myOlApp.ItemSend

See if that helps.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"sophie" wrote in message
...
hi,
I want to code a small project which can pop up a warning when user
click
send a email.
But it doesnt work for application_itemsend.
i work with VS2008, vb.

the code is here.

Public Class ThisAddIn
Public WithEvents myOlApp As Outlook.Application
Event ItemSend As AssemblyLoadEventHandler


Public Sub Initialize_handler()
myOlApp = CreateObject("Outlook.Application")
End Sub


Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Startup
Initialize_handler()
End Sub

Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Shutdown

End Sub

Private Sub myOlAppEvents_ItemSend(ByVal Item As Object, ByVal Cancel
As
Boolean)
Dim prompt As String
prompt = "Are you sure you want to send " & Item.Subject & "?"
If MsgBox(prompt, vbYesNo + vbQuestion, "Sample") = vbNo Then
Cancel = True
End If

End Sub

End Class

Any help is appreciated.


  #4  
Old November 11th 08, 02:27 AM posted to microsoft.public.outlook.program_addins
SOPHIE
external usenet poster
 
Posts: 21
Default application item send

Thanks for your help, Ken.
I have worked out.
BTW, Private Sub myOlApp_ItemSend(ByVal Item As Object, _
ByVal Cancel As Boolean) Handles myOlApp.ItemSend
should be (ByVal Item As Object, ByRef Cancel As Boolean)

"Ken Slovak - [MVP - Outlook]" wrote:

In a VSTO addin you should never use CreateObject to instantiate an
Outlook.Application object. Instead in the Startup event do this:

myOlApp = Me.Application


Also, change your declaration of the ItemSend event handler to this:

Private Sub myOlApp_ItemSend(ByVal Item As Object, _
ByVal Cancel As Boolean) Handles myOlApp.ItemSend

See if that helps.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"sophie" wrote in message
...
hi,
I want to code a small project which can pop up a warning when user
click
send a email.
But it doesnt work for application_itemsend.
i work with VS2008, vb.

the code is here.

Public Class ThisAddIn
Public WithEvents myOlApp As Outlook.Application
Event ItemSend As AssemblyLoadEventHandler


Public Sub Initialize_handler()
myOlApp = CreateObject("Outlook.Application")
End Sub


Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Startup
Initialize_handler()
End Sub

Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Shutdown

End Sub

Private Sub myOlAppEvents_ItemSend(ByVal Item As Object, ByVal Cancel
As
Boolean)
Dim prompt As String
prompt = "Are you sure you want to send " & Item.Subject & "?"
If MsgBox(prompt, vbYesNo + vbQuestion, "Sample") = vbNo Then
Cancel = True
End If

End Sub

End Class

Any help is appreciated.



  #5  
Old November 11th 08, 02:18 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default application item send

So it should be, thanks for the correction. I just copied your original
event signature and didn't bother to actually study it closely.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"sophie" wrote in message
...
Thanks for your help, Ken.
I have worked out.
BTW, Private Sub myOlApp_ItemSend(ByVal Item As Object, _
ByVal Cancel As Boolean) Handles myOlApp.ItemSend
should be (ByVal Item As Object, ByRef Cancel As Boolean)


  #6  
Old January 15th 09, 06:52 AM posted to microsoft.public.outlook.program_addins
BALA
external usenet poster
 
Posts: 9
Default application item send

Hi,

I am using the below code to prompt a message n the item send event. But the
control is no going to the MsgBox directly, instead i have to toggle the
screen to see the message box.

How i could able to bring up the message box in top of all by outlook pages?
Thanks for your help

Private Sub myOlAppEvents_ItemSend(ByVal Item As Object, ByVal Cancel As
Boolean)
Dim prompt As String
prompt = "Are you sure you want to send mail with out the subject ?"
If MsgBox(prompt, vbYesNo + vbQuestion, "Sample") = vbNo Then
Cancel = True
End If

End Sub


Regrds,
Bala.



"sophie" wrote:

Thanks for your help, Ken.
I have worked out.
BTW, Private Sub myOlApp_ItemSend(ByVal Item As Object, _
ByVal Cancel As Boolean) Handles myOlApp.ItemSend
should be (ByVal Item As Object, ByRef Cancel As Boolean)

"Ken Slovak - [MVP - Outlook]" wrote:

In a VSTO addin you should never use CreateObject to instantiate an
Outlook.Application object. Instead in the Startup event do this:

myOlApp = Me.Application


Also, change your declaration of the ItemSend event handler to this:

Private Sub myOlApp_ItemSend(ByVal Item As Object, _
ByVal Cancel As Boolean) Handles myOlApp.ItemSend

See if that helps.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"sophie" wrote in message
...
hi,
I want to code a small project which can pop up a warning when user
click
send a email.
But it doesnt work for application_itemsend.
i work with VS2008, vb.

the code is here.

Public Class ThisAddIn
Public WithEvents myOlApp As Outlook.Application
Event ItemSend As AssemblyLoadEventHandler


Public Sub Initialize_handler()
myOlApp = CreateObject("Outlook.Application")
End Sub


Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Startup
Initialize_handler()
End Sub

Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Shutdown

End Sub

Private Sub myOlAppEvents_ItemSend(ByVal Item As Object, ByVal Cancel
As
Boolean)
Dim prompt As String
prompt = "Are you sure you want to send " & Item.Subject & "?"
If MsgBox(prompt, vbYesNo + vbQuestion, "Sample") = vbNo Then
Cancel = True
End If

End Sub

End Class

Any help is appreciated.



  #7  
Old January 15th 09, 03:00 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default application item send

Please do not hijack threads, start your own.

You can't control the z-order or parent/child relationship of a MsgBox
unless you use Win32 API calls to get the handle of that dialog and make it
the topmost window or make it child of the current foreground window and
then set the z-order using Win32 API calls.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Bala" wrote in message
...
Hi,

I am using the below code to prompt a message n the item send event. But
the
control is no going to the MsgBox directly, instead i have to toggle the
screen to see the message box.

How i could able to bring up the message box in top of all by outlook
pages?
Thanks for your help

Private Sub myOlAppEvents_ItemSend(ByVal Item As Object, ByVal Cancel As
Boolean)
Dim prompt As String
prompt = "Are you sure you want to send mail with out the subject ?"
If MsgBox(prompt, vbYesNo + vbQuestion, "Sample") = vbNo Then
Cancel = True
End If

End Sub


Regrds,
Bala.


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Attach item from another application LuisE Outlook and VBA 5 January 3rd 08 02:40 PM
A program is trying to send mail using Item.Send he.ll.cat Outlook and VBA 3 October 18th 07 09:11 PM
A program is trying to send mail using Item.Send rhXX Outlook - General Queries 3 June 17th 07 12:28 AM
Cannot send outlook 2003 email from other application Beemer Outlook - General Queries 0 May 6th 07 09:21 AM
A program is trying to send mail using Item.Send Vitesh Outlook and VBA 1 January 23rd 06 02:25 PM


All times are GMT +1. The time now is 07:45 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.