Ken,
This is in VB6 so do not have access to the Marshal.ReleaseComObject() or
garbage collection classes.
Even if I step through this code (see below for the _open event code) and
chek the value of objApptItem after setting it to nothing as well as set it
to nothing in the uninithandler it still refuses to clear memory. However
if I do nothing in the objApptItem_open event and let the form open it
releases just fine.
Private Sub objApptItem_Open(Cancel As Boolean)
objApptItem.Close olDiscard
Set objApptItem = Nothing
Exit Sub
end sub
"Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Are you releasing all of your related Outlook objects?
>
> If this is managed code then just setting them to Nothing may not be
> enough. You might also have to call Marshal.ReleaseComObject() until the
> return value is 0 and there are no more references to that RCW, then you'd
> call GC.Collect().
>
> You can tell what's left around by looking at your locals at the time the
> class is going out of scope to see exactly what references are still in
> use.
>
> --
> 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
>
>
> "Jack" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>I have an add-in application that responds to the _open event of an
>>ApptItem (decl and sub below).
>>
>> If I do anything that sets cancel to true the add-in does not completely
>> release memory. If I debug, fire the event then remove the add-in via
>> com-addins and then stop debugging it tells me that the program is still
>> in use. Yet, if is allow the appt to open then close it things are
>> relased and the program ends without a problem.
>>
>> Is there something else I should be doing?
>>
>>
>> Appt Item declared:
>> Private WithEvents objApptItem As Outlook.AppointmentItem
>>
>> Private Sub objApptItem_Open(Cancel As Boolean)
>> cancel=true
>> End Sub
>>
>