diligent15 has asked for the wisdom of the Perl Monks concerning the following question:
hello,i have a problem,please help me.the code is as follows:
#!/usr/bin/perl -w use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; my $Excel; my $in_file_dgb = "e:/gen_ram_fifo_model/excel_list"; $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OL +E->new('Excel.Application', 'Quit'); $Excel->{DisplayAlerts} = 'False'; my $Book = $Excel->Workbooks->Open("$in_file_dgb/haha.xls"); my $worksheets_no = $Book->Worksheets->{Count}; undef $Book; undef $Excel;
the error message is : "Can't use an undefined value as a HASH reference at hehe.pl line 15 my $worksheets_no = $Book->Worksheets->{Count};". I think that the workbook is not opened,but i don't know why! I use windows xp and excel 2007. thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Excel: undef as hash ref
by Corion (Patriarch) on Mar 21, 2011 at 08:54 UTC |