Problem:
After I close the Access application completely, I go out to the Task
Manager and there is an Excel.exe object still sitting out there.
My Access application creates an Excel file (MyTestFile.XLS) just fine
per the code submitted here. This code closes the Excel file created
and close the Excel application, leaving the Access app open. Then I
close Access. After Access is closed, I go to the task mgr and an
Excel object is still out there.
Question:
How (using VBA) can I check the Task Manager of the Workstation, check
to see if an Excel object is there, and if it is there, flush it from
the Task Manager?
When this output file is created, it needs to be saved regardless.
Can this be done?
This code is from the subroutine that loops through a recordset to
create the Excel file.
<begin code>
'Dim the Excel objects smallest to largest...
Dim objXL As Excel.Application
Dim objWkb As Excel.Workbook
Dim objSht As Excel.Worksheet
Set objXL = New Excel.Application
With objXL
Set objWkb = .Workbooks.Open(conWKB_NAME)
On Error Resume Next
Set objSht = objWkb.Worksheets(conSHT_NAME)
If Not Err.Number = 0 Then
'MsgBox conSHT_NAME & " was not found in ExcelFile: " &
conWKB_NAME & vbCrLf & _
"so data will be pasted in a new sheet labeled: " &
conSHT_NAME
Set objSht = objWkb.Worksheets.Add
objSht.Name = conSHT_NAME
End If
Err.Clear
On Error GoTo 0
to create the output .XLS file.... <<> ....Do Excel stuff here
'Close Excel objects in reverse order they were declared...
'Closing Sheet, Workbook, Application...
Set objSht = Nothing
Set objWkb = Nothing
Set objXL = Nothing
<end code>
thnx....