Set m_objExplorer = Nothing

  • Thread starter Thread starter George Hester
  • Start date Start date
G

George Hester

For the code on this page:

http://www.exchangeadmin.com/Files/04/25467/Weblisting_02.txt

Set m_objExplorer = Nothing is not done. It looks as though m_objExplorers is set to nothing only when Outlook 2002 is shutdown. I understand that m_objExplorer will also go to nothing when Outlook 2002 is shut down but shouldn't it be done somewhere in the code like in:

Private Sub m_objExplorer_SelectionChange()
If Not m_objExplorer.IsPaneVisible(olOutlookBar) Then
m_objExplorer.ShowPane olOutlookBar, True
End If
Set m_objExplorer = Nothing 'My Entry
End Sub
'?

Thanks.
 
If you set it to Nothing there you'd never get another event for the
object. The code as shown releases the object in Application_Quit,
which is misleading. By the time that fires all Outlook objects are
already out of scope and the statement is useless or will fire an
error if no error handler is there. In the VBA project I just let the
objects go out of scope, although for COM addins I'm religious about
releasing all Outlook objects, otherwise Outlook stays in memory.




For the code on this page:

http://www.exchangeadmin.com/Files/04/25467/Weblisting_02.txt

Set m_objExplorer = Nothing is not done. It looks as though
m_objExplorers is set to nothing only when Outlook 2002 is shutdown.
I understand that m_objExplorer will also go to nothing when Outlook
2002 is shut down but shouldn't it be done somewhere in the code like
in:

Private Sub m_objExplorer_SelectionChange()
If Not m_objExplorer.IsPaneVisible(olOutlookBar) Then
m_objExplorer.ShowPane olOutlookBar, True
End If
Set m_objExplorer = Nothing 'My Entry
End Sub
'?

Thanks.
 
Thanks Ken. That is what I thought would happen if I put that set to nothing in there. So I didn't. I take it from what you say that this m_objExplorer goes out of scope on its own and there really is no good place to put such a Set = Nothing for that object anywhere in this code. Ok just wanted to make sure it wasn't living when it shouldn't be.
 
Back
Top