View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ken McLennan Ken McLennan is offline
external usenet poster
 
Posts: 30
Default Automation stumble - Got it!!

G'day there Bob, and whoever else was following this thread.

After being able to sit and play with it for awhile away from
being dragged about Xmas shopping and trying to mow the lawns between
thunderstorms I think I've found & fixed the problem.

It was largely a result of me trying to rush things so that I
could mow the lawns as opportunity offered, and go Xmas shopping (under
extreme duress I might add!!)

I found that when the code finished and I'd shut the spreadsheet
window there were still instances of Excel running. A bit of observation
while running the code with the task manager open & I found it wasn't
shutting Excel down. I then added extra lines, and rearranged others so
that items lower in the XL object heirarchy were released first. I.e.
range objects, then worksheet objects, then workbook objects, and
finally the application object - something that should have been obvious
if I'd not been thinking of how much I hate Xmas shopping.

Lo, and behold, at the end of the Word code there were no Excel
instances left active and when next run it all went smoothly and could
be run again & again without the symptoms described. At lease, it's done
that 4 times so far. I'm hoping that's the usual behaviour.

Thanks for looking at it for me, but I think we can now return to
normal programming ...chucklechucklechuckle. What a sense of
humour!!!! <g

Thanks once again,
Take care,
Happy Yule
See ya
Ken McLennan
Qld, Australia