View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AA2e72E[_2_] AA2e72E[_2_] is offline
external usenet poster
 
Posts: 93
Default How to detect user quitting excel

Excel, unlike Word, does not have an onQuit event. So, your application cannot know whether Excel has terminated via an event

You could use FindWindow

When you create the instance of Excel, change its caption to something unique. Use this caption to find the handle of the Windows session. Do everything that you make Excel do ..
In your code, keep checking whether the Excel handle still exists: if it does, Excel is still in use. PROBLEM: Excel could still be active but have no active workbook

Why do you need to know whether Excel is being terminated?