perl EXCEL app/Win32::OLEYou should have your pathSeparatorChar as "\\" and not "/".

Since you are using Microsoft's Excel Engine, the Excel APIs are very strict about the 
path syntax and therefore, Perl's separatorChar of "/" (forward slash) will not work!

Cheers,
Rex

----- Original Message ----- 
  From: M z 
  To: [EMAIL PROTECTED] 
  Sent: Wednesday, June 12, 2002 9:24 PM
  Subject: perl EXCEL app/Win32::OLE


  Dear all, 

  i have a simple and silly question really..I 
  downloaded this from the web, tried it, checked 
  several times to ensure that my file location was 
  correct and still had problems....the error message is 
  very obvious but I've checked file location SEVERAL 
  times...please help...oh yeah, I do have Win32:OLE 
  installed, as it came with my 5.6 build 

  thanks 

  I keep getting the following error 

  OLE exception from "Microsoft Excel" 
  'test.xls' could not be found.  

  .... 
  Win32::OLE(0.1502) error (x800a03ec in 
  method/propertyget "Open" at test.txt line 14 

  Please help!  It should be so obvious, i've checked 
  many times to ensure my location is correct and i am 
  having problems debugging 




  #C:!/usr/bin/perl -w 

  use strict; 
  use Win32::OLE qw(in with); 
  use Win32::OLE::Const 'Microsoft Excel'; 

  $Win32::OLE::Warn = 3;                               
  # die on errors... 

  # get already active Excel application or open new 
  my $Excel = 
  Win32::OLE->GetActiveObject('Excel.Application') 
      || Win32::OLE->new('Excel.Application', 'Quit');  

  # open Excel file 
  my $Book = $Excel->Workbooks->Open("c:/test.xls"); 

  # You can dynamically obtain the number of worksheets, 
  rows, and columns 
  # through the Excel OLE interface.  Excel's Visual 
  Basic Editor has more 
  # information on the Excel OLE interface.  Here we 
  just use the first 
  # worksheet, rows 1 through 4 and columns 1 through 3. 

  # select worksheet number 1 (you can also select a 
  worksheet by name) 
  my $Sheet = $Book->Worksheets(1); 

  foreach my $row (1..4) 
  { 
   foreach my $col (1..3) 
   { 
    # skip empty cells 
    next unless defined 
  $Sheet->Cells($row,$col)->{'Value'}; 

   # print out the contents of a cell  
    printf "At ($row, $col) the value is %s and the 
  formula is %s\n", 
     $Sheet->Cells($row,$col)->{'Value'}, 
     $Sheet->Cells($row,$col)->{'Formula'};        
   } 
  } 

  # clean up after ourselves 
  $Book->Close; 

  __________________________________________________ 
  Do You Yahoo!? 
  Yahoo! - Official partner of 2002 FIFA World Cup 
  http://fifaworldcup.yahoo.com 

  -- 
  To unsubscribe, e-mail: [EMAIL PROTECTED] 
  For additional commands, e-mail: [EMAIL PROTECTED] 

Reply via email to