hardy004 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings FATAL => qw( all ) ; use Win32::OLE; use Win32::OLE::Variant; use Win32::OLE::Const 'Microsoft Excel'; our $Excel = undef ; my $file = 'template_001.xlsx' ; $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application'); $Excel->{DisplayAlerts}=0; #0 is hide alerts # Open File and Worksheet my $Book = $Excel->Workbooks->Open($file) or die "Can't open workbook\ +n" ; print ("The excel book is $Book\n") ;
Original content restored above by GrandFather
Thanks Jim & Rob for your responses. The change i have to make is to provide the absolute path like below.This solved the problem. Previously as Jim pointed out i was specifying only the spreadsheet & assuming that the file would be picked up from the Cwd, but seem else-wise. This did solve the issue, however just for information purpose i have read at multiple places that Win32::OLE cannot be used on Cygwin domain. Is that true ?my $file = 'c:\path\subpath\template_001.xlsx' ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using Win32::OLE on cygwin
by Jim (Curate) on Nov 13, 2013 at 04:09 UTC | |
|
Re: Using Win32::OLE on cygwin
by syphilis (Archbishop) on Nov 13, 2013 at 09:03 UTC | |
|
Re: Using Win32::OLE on cygwin
by Jim (Curate) on Nov 13, 2013 at 19:39 UTC |