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 » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

MailItem Close Event



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 18th 07, 09:04 PM posted to microsoft.public.outlook.program_vba
Robert Morley
external usenet poster
 
Posts: 9
Default MailItem Close Event

Hi all,

I have a MailItem object (technically via Redemption, but as far as I can
tell, it works the same with the "normal" object library as well), which I'm
displaying on screen with the Display method. I'm monitoring the Close
event to determine if the message is not being sent. I need to find some
way of determining whether the user has clicked Cancel to the "Do you want
to save changes?" dialog and the message is really still open. Is there
some way I can do this? I've looked around most of the properties,
including the various GetInspector properties, and I can't seem to find
ANYTHING that's different whether I click "Cancel" or "No" when prompted.

Or better yet, is there an easy way to open an object with Display, then
determine when the message has been finalized (i.e., sent or truly closed)?



Thanks,
Rob


Ads
  #2  
Old April 19th 07, 06:20 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default MailItem Close Event



You will get either the MailItem's Send event or its Inspector's Close
event.

Another possibility is that the user deletes the message. Then the
MailItem's BeforeDelete fires after the user had the chance to cancel. That
event is available sinve OL XP.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:
http://www.vboffice.net/product.html...&lang=en&pub=6

Am Wed, 18 Apr 2007 16:04:53 -0400 schrieb Robert Morley:

Hi all,

I have a MailItem object (technically via Redemption, but as far as I can
tell, it works the same with the "normal" object library as well), which

I'm
displaying on screen with the Display method. I'm monitoring the Close
event to determine if the message is not being sent. I need to find some
way of determining whether the user has clicked Cancel to the "Do you want
to save changes?" dialog and the message is really still open. Is there
some way I can do this? I've looked around most of the properties,
including the various GetInspector properties, and I can't seem to find
ANYTHING that's different whether I click "Cancel" or "No" when prompted.

Or better yet, is there an easy way to open an object with Display, then
determine when the message has been finalized (i.e., sent or truly

closed)?



Thanks,
Rob

  #3  
Old April 19th 07, 06:29 AM posted to microsoft.public.outlook.program_vba
Robert Morley
external usenet poster
 
Posts: 9
Default MailItem Close Event

But what's happening is that the Close event is firing *before* the
Yes/No/Cancel question is answered. So if the user says Cancel, then sends
the message, I've already processed the Close event. How can I tell, either
during the Close event or immediately afterwards, whether the message was
actually closed or if it's still on-screen?


Rob

"Michael Bauer [MVP - Outlook]" wrote in message
...


You will get either the MailItem's Send event or its Inspector's Close
event.

Another possibility is that the user deletes the message. Then the
MailItem's BeforeDelete fires after the user had the chance to cancel.
That
event is available sinve OL XP.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:
http://www.vboffice.net/product.html...&lang=en&pub=6

Am Wed, 18 Apr 2007 16:04:53 -0400 schrieb Robert Morley:

Hi all,

I have a MailItem object (technically via Redemption, but as far as I can
tell, it works the same with the "normal" object library as well), which

I'm
displaying on screen with the Display method. I'm monitoring the Close
event to determine if the message is not being sent. I need to find some
way of determining whether the user has clicked Cancel to the "Do you
want
to save changes?" dialog and the message is really still open. Is there
some way I can do this? I've looked around most of the properties,
including the various GetInspector properties, and I can't seem to find
ANYTHING that's different whether I click "Cancel" or "No" when prompted.

Or better yet, is there an easy way to open an object with Display, then
determine when the message has been finalized (i.e., sent or truly

closed)?



Thanks,
Rob



  #4  
Old April 19th 07, 08:37 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default MailItem Close Event



Simply do not process anythign in the MailItem's Close event, but wait for
one of the other events.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:
http://www.vboffice.net/product.html...&lang=en&pub=6

Am Thu, 19 Apr 2007 01:29:19 -0400 schrieb Robert Morley:

But what's happening is that the Close event is firing *before* the
Yes/No/Cancel question is answered. So if the user says Cancel, then

sends
the message, I've already processed the Close event. How can I tell,

either
during the Close event or immediately afterwards, whether the message was
actually closed or if it's still on-screen?


Rob

"Michael Bauer [MVP - Outlook]" wrote in message
...


You will get either the MailItem's Send event or its Inspector's Close
event.

Another possibility is that the user deletes the message. Then the
MailItem's BeforeDelete fires after the user had the chance to cancel.
That
event is available sinve OL XP.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:
http://www.vboffice.net/product.html...&lang=en&pub=6

Am Wed, 18 Apr 2007 16:04:53 -0400 schrieb Robert Morley:

Hi all,

I have a MailItem object (technically via Redemption, but as far as I

can
tell, it works the same with the "normal" object library as well), which

I'm
displaying on screen with the Display method. I'm monitoring the Close
event to determine if the message is not being sent. I need to find

some
way of determining whether the user has clicked Cancel to the "Do you
want
to save changes?" dialog and the message is really still open. Is there
some way I can do this? I've looked around most of the properties,
including the various GetInspector properties, and I can't seem to find
ANYTHING that's different whether I click "Cancel" or "No" when

prompted.

Or better yet, is there an easy way to open an object with Display, then
determine when the message has been finalized (i.e., sent or truly

closed)?



Thanks,
Rob

  #5  
Old April 19th 07, 06:12 PM posted to microsoft.public.outlook.program_vba
Robert Morley
external usenet poster
 
Posts: 9
Default MailItem Close Event

What other events fire when an item is closed, but not saved? I couldn't
find anything that fired and was distinguishable.



Rob

"Michael Bauer [MVP - Outlook]" wrote in message
news


Simply do not process anythign in the MailItem's Close event, but wait for
one of the other events.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:
http://www.vboffice.net/product.html...&lang=en&pub=6

Am Thu, 19 Apr 2007 01:29:19 -0400 schrieb Robert Morley:

But what's happening is that the Close event is firing *before* the
Yes/No/Cancel question is answered. So if the user says Cancel, then

sends
the message, I've already processed the Close event. How can I tell,

either
during the Close event or immediately afterwards, whether the message was
actually closed or if it's still on-screen?


Rob

"Michael Bauer [MVP - Outlook]" wrote in message
...


You will get either the MailItem's Send event or its Inspector's Close
event.

Another possibility is that the user deletes the message. Then the
MailItem's BeforeDelete fires after the user had the chance to cancel.
That
event is available sinve OL XP.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:

http://www.vboffice.net/product.html...&lang=en&pub=6

Am Wed, 18 Apr 2007 16:04:53 -0400 schrieb Robert Morley:

Hi all,

I have a MailItem object (technically via Redemption, but as far as I

can
tell, it works the same with the "normal" object library as well),
which
I'm
displaying on screen with the Display method. I'm monitoring the Close
event to determine if the message is not being sent. I need to find

some
way of determining whether the user has clicked Cancel to the "Do you
want
to save changes?" dialog and the message is really still open. Is
there
some way I can do this? I've looked around most of the properties,
including the various GetInspector properties, and I can't seem to find
ANYTHING that's different whether I click "Cancel" or "No" when

prompted.

Or better yet, is there an easy way to open an object with Display,
then
determine when the message has been finalized (i.e., sent or truly
closed)?



Thanks,
Rob



  #6  
Old April 19th 07, 07:41 PM posted to microsoft.public.outlook.program_vba
Robert Morley
external usenet poster
 
Posts: 9
Default MailItem Close Event

Just to give you a better idea of what I'm trying to accomplish, I'm
creating a new e-mail and populating the subject, body, etc., then
displaying it on-screen. I then need to wait (indefinitely) until one of
three things occurs, and determine with absolute certainty which one it was:
the e-mail is sent; the e-mail is saved but not sent, the e-mail is
cancelled without being saved or sent.

It's those last two that're causing the big headache, since the Close event
happens before the Save Yes/No/Cancel question is asked. That means I have
no way of determining what actually happened to the outgoing e-mail after
that point.

I've tried monitoring the "BeforeDelete" event, but it doesn't fire if the
message is new (whether or not I save it before-hand).



Thanks,
Rob


  #7  
Old April 19th 07, 08:01 PM posted to microsoft.public.outlook.program_vba
Robert Morley
external usenet poster
 
Posts: 9
Default MailItem Close Event

A-ha!

Okay, after poking around a bit, I've determined that what I need to do is
to monitor the Inspector's Close event, not the MailItem's Close event.
That will tell me deterministically when the window has been closed, and
from that point, I can determine what actually happened to the item by
looking at its Saved property, which will be either True, False, or raise an
error if the item has been sent successfully.

Thanks for trying to help me out. I appreciate your efforts.



Rob

"Michael Bauer [MVP - Outlook]" wrote in message
news


Simply do not process anythign in the MailItem's Close event, but wait for
one of the other events.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:
http://www.vboffice.net/product.html...&lang=en&pub=6

Am Thu, 19 Apr 2007 01:29:19 -0400 schrieb Robert Morley:

But what's happening is that the Close event is firing *before* the
Yes/No/Cancel question is answered. So if the user says Cancel, then

sends
the message, I've already processed the Close event. How can I tell,

either
during the Close event or immediately afterwards, whether the message was
actually closed or if it's still on-screen?


Rob

"Michael Bauer [MVP - Outlook]" wrote in message
...


You will get either the MailItem's Send event or its Inspector's Close
event.

Another possibility is that the user deletes the message. Then the
MailItem's BeforeDelete fires after the user had the chance to cancel.
That
event is available sinve OL XP.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:

http://www.vboffice.net/product.html...&lang=en&pub=6

Am Wed, 18 Apr 2007 16:04:53 -0400 schrieb Robert Morley:

Hi all,

I have a MailItem object (technically via Redemption, but as far as I

can
tell, it works the same with the "normal" object library as well),
which
I'm
displaying on screen with the Display method. I'm monitoring the Close
event to determine if the message is not being sent. I need to find

some
way of determining whether the user has clicked Cancel to the "Do you
want
to save changes?" dialog and the message is really still open. Is
there
some way I can do this? I've looked around most of the properties,
including the various GetInspector properties, and I can't seem to find
ANYTHING that's different whether I click "Cancel" or "No" when

prompted.

Or better yet, is there an easy way to open an object with Display,
then
determine when the message has been finalized (i.e., sent or truly
closed)?



Thanks,
Rob



  #8  
Old April 19th 07, 08:04 PM posted to microsoft.public.outlook.program_vba
Robert Morley
external usenet poster
 
Posts: 9
Default MailItem Close Event

Sorry, looking back, you had pointed me to the Inspector's Close event in
your very first response; I hadn't picked up on it, and thought you were
still referring to the MailItem's Close event. My bad!



Rob

"Michael Bauer [MVP - Outlook]" wrote in message
...


You will get either the MailItem's Send event or its Inspector's Close
event.

Another possibility is that the user deletes the message. Then the
MailItem's BeforeDelete fires after the user had the chance to cancel.
That
event is available sinve OL XP.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:
http://www.vboffice.net/product.html...&lang=en&pub=6

Am Wed, 18 Apr 2007 16:04:53 -0400 schrieb Robert Morley:

Hi all,

I have a MailItem object (technically via Redemption, but as far as I can
tell, it works the same with the "normal" object library as well), which

I'm
displaying on screen with the Display method. I'm monitoring the Close
event to determine if the message is not being sent. I need to find some
way of determining whether the user has clicked Cancel to the "Do you
want
to save changes?" dialog and the message is really still open. Is there
some way I can do this? I've looked around most of the properties,
including the various GetInspector properties, and I can't seem to find
ANYTHING that's different whether I click "Cancel" or "No" when prompted.

Or better yet, is there an easy way to open an object with Display, then
determine when the message has been finalized (i.e., sent or truly

closed)?



Thanks,
Rob



  #9  
Old April 19th 07, 09:03 PM posted to microsoft.public.outlook.program_vba
Robert Morley
external usenet poster
 
Posts: 9
Default MailItem Close Event

What's funny about all this is that it seems that whatever reason I had for
not using a modal display is no longer applicable, and I'm going through all
this effort for nothing. sigh!


Rob

"Robert Morley" wrote in message
...
Sorry, looking back, you had pointed me to the Inspector's Close event in
your very first response; I hadn't picked up on it, and thought you were
still referring to the MailItem's Close event. My bad!



Rob

"Michael Bauer [MVP - Outlook]" wrote in message
...


You will get either the MailItem's Send event or its Inspector's Close
event.

Another possibility is that the user deletes the message. Then the
MailItem's BeforeDelete fires after the user had the chance to cancel.
That
event is available sinve OL XP.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - Categorize Outlook data:
http://www.vboffice.net/product.html...&lang=en&pub=6

Am Wed, 18 Apr 2007 16:04:53 -0400 schrieb Robert Morley:

Hi all,

I have a MailItem object (technically via Redemption, but as far as I
can
tell, it works the same with the "normal" object library as well), which

I'm
displaying on screen with the Display method. I'm monitoring the Close
event to determine if the message is not being sent. I need to find
some
way of determining whether the user has clicked Cancel to the "Do you
want
to save changes?" dialog and the message is really still open. Is there
some way I can do this? I've looked around most of the properties,
including the various GetInspector properties, and I can't seem to find
ANYTHING that's different whether I click "Cancel" or "No" when
prompted.

Or better yet, is there an easy way to open an object with Display, then
determine when the message has been finalized (i.e., sent or truly

closed)?



Thanks,
Rob





 




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
Explorer' Close event not fired j Add-ins for Outlook 9 April 2nd 07 02:24 PM
event handler for changes to TO CC and BCC properties of mailitem epsilon_9 Outlook and VBA 3 January 15th 07 03:14 PM
Inspector Close Event is fired when spell checking is canceled. Arcady Outlook and VBA 6 December 28th 06 02:38 PM
Changing RTF Body on MailItem Read event [email protected] Add-ins for Outlook 3 September 13th 06 07:30 PM
Cancelling Outlook.Application.ActiveExplorer.Close event? Nathan Add-ins for Outlook 1 September 8th 06 07:14 PM


All times are GMT +1. The time now is 06:55 PM.


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.