Dear All,

I am having an XLSX file in server and my OS in Win7. The first open
statement is working fine in which we have give the actual file name.

2nd open function is not working where we have given the file name as
variable.

Please help in resolving this error.


use Win32::OLE;
use Win32::OLE qw(in with);
use Win32::OLE::Variant;
use Win32::OLE::Const 'Microsoft Excel';
$emfile="02896787";
$Excel = Win32::OLE->GetActiveObject('Excel.Application') ||
       Win32::OLE->new('Excel.Application');
$Excel->{'Visible'} = 0;        #0 is hidden, 1 is visible
$Excel->{DisplayAlerts}=0;    #0 is hide alerts
my $mBook = $Excel->Workbooks->Open
             ('\\\\pchns2003z\SPECIALIZED_SERVICES_I\AnI\Embase\Pull
files_IRNPD\inventory\02896787.xlsx'); # open Excel file

my $meBook = $Excel->Workbooks->Open
             ("\\\\pchns2003z\\SPECIALIZED_SERVICES_I\\AnI\\Embase\\Pull
files_IRNPD\\inventory\\$emfile.xlsx"); # open Excel file

$Sheet2 = $mBook->Worksheets(1);
$Sheet3 = $meBook->Worksheets(1);

Regards,
Ganesh

Reply via email to