if you don't care about saving the open worksheets try this:
Function killAllXL() 'superkiller for remaining excel instances
' On Error Resume Next
Dim objs As Object
Dim obj As Object
Dim strSQL As String
Dim strWMI As String
strWMI = "winmgmts:"
strSQL = "Select * From Win32_Process "
strSQL = strSQL & "where Name = 'EXCEL.EXE'"
Set objs = GetObject(strWMI).ExecQuery(strSQL)
For Each obj In objs
obj.Terminate
Next
Set objs = Nothing
End Function
if you do care about open books then loop with:
on error resume next
Set oXL = GetObject(, "Excel.Application")
if not oXL is noting then... save eit and exit
but his will not close an instance with open references (e.g., an object set
to range within) so after a bit (counter = 10) do the kill thing above.
crude but works for me.
mb
"