Hi Friends,
I am trying to open particular Worksheet from MS Excel workbook (WIN32 :: OLE).
I cannot able to work on particular sheet. Please help me on this :
Please point me what went wrong. Its giving Error at $sheet->Activate itself!!
One More thing : If i want to print content of the cells, i am storing it in $_ and printing it. Is there is other way to print content of cells within 'Print' Statement?
I am trying to open particular Worksheet from MS Excel workbook (WIN32 :: OLE).
I cannot able to work on particular sheet. Please help me on this :
Code:
$Excel = Win32::OLE->GetActiveObject('Excel.Application'); $Excel->{'Visible'} = 0; $Excel->{DisplayAlerts}=0; # Open File and WorkSheet $Book = $Excel->Workbooks->Open("d:\test.xls"); $Sheet = $Book->WorkSheets(1)->{marks}; $Sheet = $Book->WorkSheets($Sheet); $Sheet->Activate; $LastRow = $Sheet->UsedRange->Find({What=>"*", SearchDirection=>xlPrevious, SearchOrder=>xlByRows})->{Row}; $LastCol = $Sheet->UsedRange->Find({What=>"*", SearchDirection=>xlPrevious, SearchOrder=>xlByColumns})->{Column}; $mylastcol = 'A'; for ($m=1; $m < $LastCol; $m++){ $mylastcol++; } print "Last Row in Sheet $ARGV[2] : $LastRow, Last Col : $LastCol\n"; [B]$_ = $Sheet -> Range("A7") -> {Value}; print "Value of Test Cell : $_ \n";[/B] $Book->Close(); $Excel->Quit();
One More thing : If i want to print content of the cells, i am storing it in $_ and printing it. Is there is other way to print content of cells within 'Print' Statement?
Comment