in reply to Re^2: cygwin, make, perl, win32::ole (excel) problem
in thread cygwin, make, perl, win32::ole (excel) problem

Hi ,

My point was that the error tells you that the call $Excelbook->SaveAs is being made against an undefined value, hence $Excelbook is undefined after $Excelbook = $Excel->Workbooks->Open("$template_path.\\filereport.xls"); has executed, so if you changed it to read

$Excelbook = $Excel->Workbooks->Open("$template_path.\\filereport.xls" +) || die "Cannot open - $template_path.\\filereport.xls" . Win32::OLE-> +LastError;
instead, then, in all probability, you'd get a bit, tho' probably not much, more help from Windoze itself as to why the open failed.

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^4: cygwin, make, perl, win32::ole (excel) problem
by cugetare (Initiate) on Dec 03, 2008 at 15:09 UTC
    Hello, I have followed your advice and here is the result:
    Cannot open - Y:\In\filereport.xlsOLE exception from "Microsoft Office + Excel": Excel cannot access 'filereport.xls'. The document may be read-only o +r encrypted. Win32::OLE(0.1703) error 0x800a03ec in METHOD/PROPERTYGET "Open" at Y:/In/FileReport.pl line 172
    The file is not read-only or write protected and it shouldn't be, this is the main reason I'm using Y: drive, which is mapped as a basic user and grants full control to it. I googled the 0x800a03ec error but didn't came up with something relevant, I will continue digging the internet for an answaer to this error. If you have any ideea abut this err please help ! Thanks.

      Always give absolute filenames to Excel. The "current directory" for an OLE object can very well differ from what your application thinks its current directory is. So if you change filereport.xls to become Y:\In\filereport.xls in your call to $excel->Workbooks->Add() it should work, or fail in a different way.

        Hi Corion,

        Long time, no speak.

        AFAICT (from the generated error message) an absolute path _is_ being passed in - it appears as tho' Excel takes it upon itself to report the error as a relative path - I wondered, as you've no doubt seen, whetehr the containing dir exists with the right perms...

        Update

        self-- ... I got Corions name wrong :-((

        A user level that continues to overstate my experience :-))
      You are sure that the containing directory In exists in Y:\\ and has the same permissions as the mount point ??

      A user level that continues to overstate my experience :-))
        Hi, Inside Y:\in\ are all the input files that are needed for the operation, including the perl script and the excel template. when mapping a virtual drive all its components (files) inherit the virtual root drive proerties that has been created, this is the reason I am using this method.