tkpstock
Cubicle Warrior
- Local time
- Today, 14:23
- Joined
- Feb 25, 2005
- Messages
- 206
I am opening an Excel application from Access using VBA. When I execute the following code and then close the form, the Excel process is still running in Windows Task Manager - why? Is there some sort of garbage collection routine I need to run? Am I not killing the Excel application correctly? Here is my code:
Ultimately what happens is that I get a windows error "Null Pointer Problem" when I try to open up Excel again...
Thanks!!!
Code:
Dim oXL As Excel.Application
Dim oWbk As Excel.Workbook
Dim oWst As Excel.Worksheet
Set oXL = CreateObject("Excel.Application")
Set oWbk = oXL.Workbooks.Add
Set oWst = oWbk.Sheets(1)
oWst.Cells(1, 1) = "test"
oWbk.SaveAs "c:\Temp.xls"
oWbk.Close
oXL.Quit
Set oWst = Nothing
Set oWbk = Nothing
Set oXL = Nothing
Ultimately what happens is that I get a windows error "Null Pointer Problem" when I try to open up Excel again...
Thanks!!!
Last edited: