View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Sriram Sriram is offline
external usenet poster
 
Posts: 50
Default Is it possible to Shell and remove Excel from memory?

Alain

Try this

Try

....

Finally
NAR(m_objSheet)
m_objSheet = Nothing
NAR(objWorkbook) ' This is required - MS Excel has an inherent bug.
objWorkbook = Nothing
objExcel.Quit()
NAR(objExcel)
objExcel = Nothing
End Try
....

Private Sub NAR(ByVal objExcelRelated As Object)
Try

System.Runtime.InteropServices.Marshal.ReleaseComO bject(objExcelRelated)
Catch
Finally
objExcelRelated = Nothing
End Try
End Sub



"alainB" wrote:


Yes, Application.Quit! Should work but it is not in my code. Excel is
not quitting.

Anyway, I found a way to do it. Instead of running my dialer from the
Shell directly, I shell to a Batch file that call my dialer. In that
case, Application.Quit is working fine.

Alain


--
alainB
------------------------------------------------------------------------
alainB's Profile: http://www.excelforum.com/member.php...fo&userid=8367
View this thread: http://www.excelforum.com/showthread...hreadid=550622