Quote Originally Posted by dglienna
You are only setting the Excel Object to nothing if you close it there.
You should set it to nothing regardless. Put the duplicated code after the if statemnt. It won't hurt to set it to nothing twice.

Follow the steps above with everything.

Here is a module I use to close my apps.


VB Code:
  1. Option Explicit
  2.  
  3. Private Sub Command1_Click()
  4.  Dim frm As Form
  5.   Dim obj As Object
  6.   For Each frm In Forms
  7.      If frm.Name <> Me.Name Then ' Unload this form LAST
  8.        For Each obj In frm
  9.          On Error Resume Next
  10.            Unload obj
  11.            Set obj = Nothing
  12.        Next
  13.        Unload frm
  14.        Set frm = Nothing
  15.      End If
  16.     Next
  17.     On Error Resume Next
  18.       For Each obj In frm
  19.         Unload obj
  20.         Set obj = Nothing
  21.       Next
  22.       Set frm = Nothing
  23.       Unload Me
  24. End Sub
This will not work with Excel objects as it is more used for VB variable objects.

Without seeing all your Excel code we can not determine what your leaving open. You MUST close and destroy all Excel objects and quit and destroy the application(s) object(s) in order to release all references to Excel and allow it to close.