#!c:\perl\bin\ -w use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); use strict; my $configfile = "OleoresinSpreadsheet2.conf"; open (CONFIG,$configfile); my $HPLC_Collum; if(=~/;;HPLCColumn;;([0-9]+);/){ $HPLC_Collum= $1; } my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); my $excelfile = 'F:\Spreadsheet\lab results\COPY GRID MASTER COPY.xls'; my $Book = $Excel->Workbooks->Open($excelfile); my $WorkBooknumber = 6; my $Sheet = $Book->Worksheets($WorkBooknumber); print($HPLC_Collum); print($Sheet->Cells(6,$HPLC_Collum)->{'Value'}); #### Win32::OLE(0.1709) error 0x800a03ec in METHOD/PROPERTYGET "Cells" at C:\Documents and Settings\KHusband\Desktop\ New Folder\test2.pl line 20 Can't use an undefined value as a HASH reference at C:\Documents and Settings\KH usband\Desktop\New Folder\test2.pl line 20, line 1. 18