views:

182

answers:

3
#___ FIND LAST ROW/COLUMN WITH DATA
my $row = $Sheet1 -> UsedRange -> Find(
     {      What => "*", 
            SearchDirection => xlPrevious,  
            SearchOrder => xlByRows
      })-> {Row};

Error:

Bareword "xlByRows" not allowed while "strict subs" in use.
+1  A: 

xlByRows is not a constant, you should put it in quotes. Unless it's a constant exported by the OLE object, in which case you need to import it into your namespace using Win32::OLE::Const or similar.

Andrew Barnett
+4  A: 

You have to put use Win32::OLE::Const 'Microsoft Excel'; at the top of your program to import the constants correctly.

Take a look at this Perl Monks page. It seems to cover the issues you are having.

gdey
+4  A: 

See CPAN docs for Win32::OLE::Const

You need to:

use Win32::OLE::Const 'Microsoft Excel';
denkfaul

related questions