Jump to content

Excel/php/com problems


Recommended Posts

OK, so I am trying to write a small summary page that will read in data from a few excel files that a bunch of people have all around our office, and display it on a public display board. I have a vista business computer set up with Apache running in the background as a service (it should be using my user credentials).

the problem is when ever I try to open a file through the excel object I got through PHP's COM interface, it fails giving the generic "can't open it" error.

I can open the file just fine if I go to it and double click or if I type the address into the address bar.

if I do not try to open a file the excel object seems to work fine, but it's fairly useless if I can't open any files

I have tried turning off the firewall with no effect.

I have tried turning off UAC with no effect.

at the moment everything is happening on the same machine so there really should be no network complications at this point.

the files are in the public directory so anyone should have access to them.

the code I am testing with at this moment is this

   $PPMH_path = "C:\\Users\\Public\\test.xls";

try{
$excel=new COM("excel.application") or die("unable to start Excel on server!");

$excel->DisplayAlerts = 0;
$excel->Visible = 0;
$excel->Workbooks->Open($PPMH_path);
$excel->Quit();

} catch (Exception $e) {
echo "\n**error** ".$e;
$excel->Quit();
}

the error I get is this

exception 'com_exception' with message 'Source: Microsoft Office Excel

Description: Microsoft Office Excel cannot access the file 'C:\Users\Public\test.xls'. There are several possible reasons: • The file name or path does not exist. • The file is being used by another program. • The workbook you are trying to save has the same name as a currently open workbook.' in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\info\info.php:16 Stack trace: #0 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\info\info.php(16): variant->Open('C:\Users\Public...') #1 {main}

Link to comment
Share on other sites

  • 1 month later...

  • 4 weeks later...

the problem is that these are files being used by other people I have no choice but to use several different versions of excel files, if this would just work as advertised everything would be fine, but it doesn't, I'm starting to get the impression that I'm the only person using this interface because the only references to it I find through google are my own unanswered pleas for help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...