I'm attempting to export data from my Access database to an Excel workbook. Everything works fine, except that I can't get Excel to properly shut down after the export is complete. When I open up the Task Manager after the code executed, an instance of Microsoft Excel is always listed under Background Processes. I read various comments suggesting that the issue might be that, somewhere between creating the initial Excel.Application object and attempting to close it, another Excel.Application is secretly being created. As a result, I trimmed the code down to the point where all it does is creating and closing an Excel.Application object. Still the same result.
This is my code:
Sub testexcel()
Dim xl As Excel.Application
Set xl = Excel.Application
xl.Quit
Set xl = Nothing
End Sub
I'd appreciate any suggestions on what I have to change to get Excel to close properly. Thanks!