Hi all.

I have a program that calls Excel from another application, does some data processing and closes Excel. For some extremely mysterious reason, the system doesn't remove the Excel object from memory after the application has run.
I have checked, double checked, triple checked, quadruple checked, quintuple checked.. you get the idea. I am releasing all Excel related objects. I don't have any "global" references to Excel, I've used late binding on all the Excel objects, etc.

I'm only left to believe that it's something entirely not related to Excel that is left as a remnant that prevents my program from being completely removed from memory.

My best guess is a little module that declares an open file dialogue function from the comdlg32.dll. Being completely new to programming I didn't write this function and only understand enough of how it works to get what I need.
So, aside from a possible solution to my problem, I'm also looking for an explanation of type defining, public v. private function declaration, and all the other things included in the sample code below.

I am including the declarations section of the module. This seems to me to be the root of my problems and lack of understanding..

VB Code:
  1. Option Explicit
  2. Public Type WinFileName
  3.  lStructSize As Long
  4.  hwndOwner As Long
  5.  hInstance As Long
  6.  lpstrFilter As String
  7.  lpstrCustomFilter As Long
  8.  nMaxCustFilter As Long
  9.  nFilterIndex As Long
  10.  lpstrFile As String
  11.  nMaxFile As Long
  12.  lpstrFileTitle As String
  13.  nMaxFileTitle As Long
  14.  lpstrInitialDir As String
  15.  lpstrTitle As String
  16.  flags As Long
  17.  nFileOffset As Integer
  18.  nFileExtension As Integer
  19.  lpstrDefExt As String
  20.  lCustData As Long
  21.  lpfnHook As Look
  22.  plTemplateName As String
  23. End Type
  24.  
  25. Public Declare Function GetWinFileName Lib "comdlg32.dll" Alias _
  26.      "GetOpenFileNameA" (pWinFileName As WinFileName) As Long
  27. Public Declare Function GetSaveFileName Lib "comdlg32.dll" Alias _
  28.      "GetSaveFileNameA" (pWinFileName As WinFileName) As Long
  29.  
  30. Public Const OFN_ALLOWMULTISELECT = &H200&
  31. Public Const OFN_EXPLORER = &H80000
  32. Public Const OFN_FILEMUSTEXIST = &H1000&
  33. Public Const OFN_HIDEREADONLY = &H4&
  34. Public Const OFN_PATHMUSTEXIST = &H800&

There it is. So I'm thinking that because these things are declared as public, they aren't going out of scope and causing my program to poo poo out.
Thoughts?

Thanks