in reply to ole problem
Have you come across the concept of error checking? You are performing two operations in the statement that starts will my $LastCol. First you are getting a value (hash ref or undef on failure), then you are extracting data by derefing the return value. Something like this should work:
my $LastCol = $sheet->UsedRange->Find({ What => $searchstr, LookAt => 2, LookIn => -4123, MatchCase => "False", SearchDirection => $searchdir, SearchOrder => xlByColumns }); return $LastCol ? $LastCol->{Column} : undef;
You also have a typo in the post as it should be ->{Column}. And -4123 looks like a constant to me so you should not be hard coding it. Same for the LookAt => 2 probably.
use Win32::OLE::Const 'Microsoft Excel'; my $x = Win32::OLE::Const->Load("Microsoft Excel 9\\.0 Object Library" +); for my $key ( sort { $x->{$a} <=> $x->{$b} } keys %$x) { printf "$key = %s\n", $x->{$key}; }
cheers
tachyon
|
|---|