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

Outlook.Application handles Quit



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 13th 06, 03:26 PM posted to microsoft.public.outlook.program_addins
donald
external usenet poster
 
Posts: 25
Default Outlook.Application handles Quit

Hi there,

I got this code below from my COM add-in which handles the Quit on my
outlook Application but it never get fired why is this? and how can i
fix this?

Thankls

Donald

Public WithEvents _Application As Outlook.Application

Private Sub app_quit() Handles _Application.Quit
MsgBox(_Application.Inspectors.Count)
MsgBox(_Application.Explorers.Count)
End Sub

Ads
  #2  
Old February 14th 06, 08:24 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook.Application handles Quit

By the time Quit fires all of you Outlook objects are out of scope so the
event won't fire correctly. It will fire in the Outlook VBA, but again all
objects are out of scope so it's a pretty useless procedure for that.

Use Explorer.Close and Inspector.Close to check the counts of both
collections.

--
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


"donald" wrote in message
oups.com...
Hi there,

I got this code below from my COM add-in which handles the Quit on my
outlook Application but it never get fired why is this? and how can i
fix this?

Thankls

Donald

Public WithEvents _Application As Outlook.Application

Private Sub app_quit() Handles _Application.Quit
MsgBox(_Application.Inspectors.Count)
MsgBox(_Application.Explorers.Count)
End Sub


  #3  
Old February 15th 06, 05:17 PM posted to microsoft.public.outlook.program_addins
donald
external usenet poster
 
Posts: 25
Default Outlook.Application handles Quit

Hi Ken,

Thanks for your reply.

I basic don't know outlook to close and my COM add-in to close if there
are any Inspector Open?

How would i do about doing this?

Thanks

Donald

  #4  
Old February 16th 06, 03:45 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook.Application handles Quit

Outlook won't close if there are any open Inspectors or Explorers. That
would keep it open.

You must check for any existing Explorers and Inspectors when an
Inspector.Close or Explorer.Close event fires, something like this:

Private Sub objExpl_Close()
On Error Resume Next

'Current Explorer is closing--update identity to ActiveExplorer
Set objExpl = objOutlook.ActiveExplorer

'if this is the last Explorer, then objExpl = Nothing -close down
If (objExpl Is Nothing) And (objOutlook.Inspectors.Count = 0) Then
UnInitHandler
End If
End Sub

Private Sub objInsp_Close()
On Error Resume Next

Set objInsp = objOutlook.ActiveInspector

If objOutlook.Explorers.Count = 0 And objOutlook.Inspectors.Count = 1
Then
UnInitHandler
End If
End Sub

--
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


"donald" wrote in message
ups.com...
Hi Ken,

Thanks for your reply.

I basic don't know outlook to close and my COM add-in to close if there
are any Inspector Open?

How would i do about doing this?

Thanks

Donald


 




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
How do I pass parameters to application invoked by Outlook rule? Sergy Stouk Outlook - Installation 1 March 20th 06 01:18 PM
Adelphia e mail used to down load into outlook, then just quit can afancyroz Outlook - Installation 0 March 3rd 06 04:23 AM
Outlook.exe won't shut down when closing the application. Ron S Outlook - Installation 1 February 23rd 06 08:59 PM
Outlook Application variable problem Ram Add-ins for Outlook 0 February 12th 06 03:25 PM
Outlook 2000 Links quit working Richard Outlook - General Queries 2 February 3rd 06 09:39 PM


All times are GMT +1. The time now is 02:56 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.