in reply to MS Excel 2007 never dies - or at least the process wont

No solution, I'm afraid, but possibly some pointers. I'm running XP pro but I run Excel 2002 as it has various features I like or need. When I run your code, I don't get any Excel files opened because the code runs only in the directory in which it exists itself (not how I would write it) and I don't have Excel files there. I get a "File not found" message and the instance of Excel ends.

I hope you understand why I don't want to mix up your problem code with my valuable Excel files. If you are looking in the right place for your problem, it may be down to the Excel version. I don't have 2007, but look in the configuration options for anything that might cause it to persist. It will be an option that doesn't exist in earlier versions, if you have something like 2002 or 2003 for comparison.

However, there are some very strange things in your code. I'm reluctant to do a full critique while you're trying to solve a different problem, but do you realise, for example, that you are creating your Excel instance before your while loop but then trying to destroy it within the while loop? This means that you will try to destroy the instance once for each file. One of two things will happen. Either it will be impossible to process more than one file (because Excel has been destroyed) or Perl will do some of its famous DWIMmery and create a new Excel instance inside the loop, meaning that the one created outside the loop will not be destroyed. This is pretty wild speculation by me, but it might explain your problem.

It's also possible that you have an XY problem. If you tell us what you are really trying to do, we might be able to help you more.

Regards,

John Davies

  • Comment on Re: MS Excel 2007 never dies - or at least the process wont