in reply to Re^2: Win32-OLE: What is the canonical way to open file for editing?
in thread Win32-OLE: What is the canonical way to open file for editing?

Yes, I think your last two code fragments should work fine. I will admit to being far briefer (and hence possibly less rigorous) myself because I'm an accountant & I've never encountered (at least for the last decade or two) an accountant's machine without Excel. I typically start with my $xl = Win32::OLE->new('Excel.Application'); and end either with your Quit line or nothing if I want to leave the Excel instance open (for the user to manipulate further, for example). Since the Quit is close to the end of my code, if not at the end, I just let Perl exit and trust Perl & Windows to sort out memory. If starting Excel doesn't work, it's going to crash somehow and I'm not particularly worried about how, since I've never seen it in the wild. I'm far more defensive with my VBA, though!

Regards,

John Davies

  • Comment on Re^3: Win32-OLE: What is the canonical way to open file for editing?
  • Download Code