Excel does not quit

J

jmassa1978

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top