in reply to Unexpected Excel TypeLib error
If you look at the examples in Win32::OLE::Const, you'll see that your use statement needs to be more like:
use Win32::OLE::Const ('Microsoft Excel 8.0 Object Library');Of course, the problem with that is that your code is now expecting only one version of Excel. The '8.0' would need to be changed to support another version of Excel. One way around this that I have done is to use the following line instead:
use Win32::OLE::Const "Microsoft Excel .* Object Library";This will load the Excel object library for whichever version of Excel is installed - and will hit issues if Excel is not installed. Just keep in mind that there is a chance that Microsoft may change/add/remove constants between versions of Excel. Also, you might want to keep in mind that other behaviors can change between Excel versions that could seriously impact your code - such saving the spreadsheet, which requires different code for Excel 97 and newer Excel versions.
|
|---|