ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel does not quit (https://www.excelbanter.com/excel-programming/391854-excel-does-not-quit.html)

[email protected]

Excel does not quit
 
I use VB in an Access database to Launch excel. It pastes data into
cells, formats, etc. All the references created are set to Nothing
before terminating. But when I do xl.Quit, nothing happens. No error,
Excel.exe just stays open endlessly. The only way I've found I could
terminate excel would be to manually select excel in the task manager
process list and terminate it. This isn't a very efficient way of
working considering this process creates 20+ excel files. I have seen
many postings regarding this issue but nothing has worked.
Fortunately, I have narrowed down and found the 2 lines of code that
seem to be causing this issue. It happens when I try to freeze
panes. I have run the automation without the 2 lines and it works
fine. I do not know of any other lines of code to do a freeze pane.
If anyone know how to force excel to quit or another way of coding the
below 2 lines, I would greatly appreciate.

2 troublesome lines of code causing issue:
xl.ActiveCell.Offset(9, 7).Select
xl.ActiveWindow.FreezePanes = True

Thanks in advance



All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com