The following code is the OnClick even on a form in my Access database. (I also show my public functions that are in Module1.) It works well the first time only. After the first time it runs, the excel file genereated by CreateObject is still in memory and either the KillFile function fails or the excel window is not viewable on the screen. Task Manager shows the EXCEL.EXE instance and when I end that task and manually open Excel, the second instance is "recovered". Help 

Code:
Public Function GetUserName()
GetUserName = Environ("UserName")
End Function
Public Function KillProperly(Killfile As String)
If Len(Dir$(Killfile)) > 0 Then
SetAttr Killfile, vbNormal
Kill Killfile
End If
End Function
Private Sub test2_Click()
Dim myPath As String
Dim myDocName As String
Dim xl As Excel.Application
Dim xlwb As Excel.Workbook
Dim xlws As Excel.Worksheet
myDocName = "dpt_ron_schd"
myPath = "C:\Documents and Settings\" & GetUserName & "\My Documents\" & myDocName & ".xls"
KillProperly myPath
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
"tbl_dpt_ron_schd", myPath
Set xl = CreateObject("Excel.Application")
Set xlwb = GetObject(myPath)
xl.Visible = True
xlwb.Windows(1).Visible = True
xlwb.Save
Set xlws = xlwb.ActiveSheet
'THIS IS WHERE CODE IS TO CREATE PIVOT TABLES WITHIN THE EXCEL FILE
Set xl = Nothing
Set xlwb = Nothing
Set xlws = Nothing
End Sub