in reply to Problems with Win32::OLE and different Office versions

The problem is with the path used $restrictfile. I get your error if my path is wrong, make sure you use the full absolute path.(eg 'c:\\myfiles\\test.xls') Excel defaults to My Documents when it calls Open() vs the local directory your are executing your script from.

JamesNC
  • Comment on Re: Problems with Win32::OLE and different Office versions

Replies are listed 'Best First'.
Re^2: Problems with Win32::OLE and different Office versions
by Nkuvu (Priest) on Jul 07, 2004 at 22:22 UTC

    I've also found that even though Perl can handle forward slashes as path delimiters, Excel can't. For example:

    # ... other code before this ... if (-e "c:/myfiles/test.xls") { # We get here just fine, but... $Book = $Excel->Workbooks->Open("c:/myfiles/test.xls") or die "Hork!\n"; # Dies }