<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.45">
<TITLE>Excel zombie won't die</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2 FACE="Arial"> I have an instance of Excel that I can't seem to kill except through the task manager or shutting down Access. I can make the instance visible and try to shut it down using exit off the file menu but it won't shut down that way either. The code executes without error. The code is below. What am I missing? TIA</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Jim Hale</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Public Function Load_History(intDept As Integer, strDeptname As String, _</FONT>
<BR><FONT SIZE=2 FACE="Arial">intCo As Integer, strRegioncode As String, strRegionName As String, _</FONT>
<BR><FONT SIZE=2 FACE="Arial">strAreacode As String, strDept2 As String, strPlGroup As String) As Boolean</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">dim appExcel As Excel.Application</FONT>
<BR><FONT SIZE=2 FACE="Arial">Set appExcel = Excel.Application</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">........... tons of astounding code, yada,yada,yada</FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Arial">If strPW <> "none" Then 'set password</FONT>
<BR><FONT SIZE=2 FACE="Arial"> For i = 1 To .Sheets.Count</FONT>
<BR><FONT SIZE=2 FACE="Arial"> .Worksheets(i).Protect Password:=strPW</FONT>
<BR><FONT SIZE=2 FACE="Arial"> Next i</FONT>
<BR><FONT SIZE=2 FACE="Arial"> .Sheets("instruc").Unprotect Password:=strPW</FONT>
<BR><FONT SIZE=2 FACE="Arial"> .Sheets("assumptions").Unprotect Password:=strPW</FONT>
<BR><FONT SIZE=2 FACE="Arial"> End If</FONT>
<BR><FONT SIZE=2 FACE="Arial"> .ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True</FONT>
<BR><FONT SIZE=2 FACE="Arial"> .ActiveWorkbook.Protect Structure:=True, Windows:=False, Password:=strPWworkbook</FONT>
<BR><FONT SIZE=2 FACE="Arial"> .ActiveWorkbook.SaveAs FileName:=strFileSave</FONT>
<BR><FONT SIZE=2 FACE="Arial"> .ActiveWorkbook.Close SaveChanges:=True</FONT>
<BR><FONT SIZE=2 FACE="Arial"> End With</FONT>
<BR><FONT SIZE=2 FACE="Arial"> </FONT>
<BR><FONT SIZE=2 FACE="Arial"> Load_History = True</FONT>
<BR><FONT SIZE=2 FACE="Arial">The_End:</FONT>
<BR><FONT SIZE=2 FACE="Arial"> </FONT>
<BR><FONT SIZE=2 FACE="Arial"> <B> appExcel.Quit</B></FONT>
<BR><B><FONT SIZE=2 FACE="Arial"> Set appExcel = Nothing</FONT></B>
<BR><FONT SIZE=2 FACE="Arial">dbs2.Close</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Exit Function</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Err_CreatePlan:</FONT>
<BR><FONT SIZE=2 FACE="Arial">Load_History = False</FONT>
<BR><FONT SIZE=2 FACE="Arial"> MsgBox Err.Description</FONT>
<BR><FONT SIZE=2 FACE="Arial"> Resume The_End</FONT>
<BR><FONT SIZE=2 FACE="Arial">End Function</FONT>
</P>
</BODY>
</HTML>