Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / New Users / February 2006

Tip: Looking for answers? Try searching our database.

My Com Add-ins cause outlook process blocked

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jz - 22 Feb 2006 02:16 GMT
Hi All,

I have developped an outlook Com Add-in and normaly my add in works
fine;
but when I ran it under W2K outlook 2000, I got a problem, the outlook
window is closed
but I can still find outlook.exe process in the task manager, that will
cause my Com Add-in Loading failure.

If I remove my Add In, the outlook is closed properly;
Here is what I am doing in my souce code:

Implements IDTExtensibility2

Dim WithEvents objApp As OUTLOOK.Application
Dim WithEvents objOutlookExp As OUTLOOK.Explorer
Dim WithEvents objActiveInspector As OUTLOOK.inspector
Public WithEvents objItems As OUTLOOK.Items
Dim WithEvents objAppointItem As OUTLOOK.AppointmentItem
Dim objInspector As OUTLOOK.inspector
Dim WithEvents objButtonInstant As Office.CommandBarButton
Dim WithEvents objButtonSchedule As Office.CommandBarButton
Dim objCommandBar As Office.CommandBar
Dim WithEvents Inspectors As OUTLOOK.Inspectors

then in the funciton

Private Sub objOutlookExp_Close()
   'Release Explorer Object
   'Set objOutlookExp = Nothing
   If objApp.Explorers.Count <= 1 Then
    objCommandBar.Delete
    Call Class_Terminate
    End If
End Sub

here is the Class_Terminate function

Private Sub Class_Terminate()
MsgBox "Enter the terminate function"

   Set objButtonSchedule = Nothing
   Set objButtonInstant = Nothing
   Set objAppointItem = Nothing
   Set objItems = Nothing
   Set objActiveInspector = Nothing
   Set Inspectors = Nothing
   Set objOutlookExp = Nothing
   Set objApp = Nothing

End Sub

I add msgbox here to debug. it is called correctly;

I did like what it is said in the book of Ken Slovak;

Can someone point out my problem;

and it there a way to force the process outlook.exe to be terminated?

Thank you very much

jz
Ken Slovak - [MVP - Outlook] - 22 Feb 2006 14:56 GMT
I count at least 2 objects that you aren't releasing in your close down
code. You need to be very careful to not keep any Outlook derived objects or
the addin won't let Outlook close. Another key thing to do is to make sure
you handle every possible error with an error handler.

Your test code should also be testing for Inspectors.Count as well as
Explorers.Count.

Signature

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

> Hi All,
>
[quoted text clipped - 59 lines]
>
> jz
jz - 23 Feb 2006 04:16 GMT
Thank you Ken, you are right, but also I observed that the order of the
objects to be cleaned is also very important; if I did respect set to
nothing from small objects to container, then it won't close correctly.
Ken Slovak - [MVP - Outlook] - 23 Feb 2006 14:38 GMT
I always start with my collections and unwind them if they contain objects
before I release the collection:

For i = colWhatever.Count To 1 Step -1
   colWhatever.Remove i
Next
Set colWhatever = Nothing

Signature

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

> Thank you Ken, you are right, but also I observed that the order of the
> objects to be cleaned is also very important; if I did respect set to
> nothing from small objects to container, then it won't close correctly.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.