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. 
brian d foy
  • 129,424
  • 31
  • 207
  • 592
Pankaj
  • 61
  • 4

3 Answers3

4

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.

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
gdey
  • 141
  • 5
4

See CPAN docs for Win32::OLE::Const

You need to:

use Win32::OLE::Const 'Microsoft Excel';
Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
denkfaul
  • 321
  • 2
  • 6
1

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
  • 5,066
  • 1
  • 22
  • 25