Hello everybody,

I think I have the same error on my project.

I am using a COM object in php to comunicate with excel.

Here is my code :
PHP Code:
    function make_reports($date1,$date2,$lg,$team)
    {

        
$arrd1 explode('-',$date1);
        
$arrd2 explode('-',$date2);

        
$date1 $arrd1[2]."-".$arrd1[1]."-".$arrd1[0];
        
$date2 $arrd2[2]."-".$arrd2[1]."-".$arrd2[0];

        
        if(
$date1>$date2)
        {
            
$temp $date1;
            
$date1 $date2;
            
$date2 $temp;
        }

        
connectumt();
        
        if(
$lg=='es')
        
$sql "select * from comps_es";
        else
        
$sql="select * from comps";
        
        
$res=mysql_query($sql);
        
$u=0;
        while(
$row mysql_fetch_row($res))
        {
            
$t utf8_encode($row[1]);
            
$compnamearray[$u] = $t;
            
$u++;
        }
        
$exceltemplate = new COM("Excel.application");
        
$exceltemplate->Workbooks->Open('C:\ReportFiles_global\ResultsTemplate.xls');
                
                
$booktemplate=$exceltemplate->Workbooks(1);
                
$sheettemplate=$booktemplate->Worksheets(1);
                            
                
$app $exceltemplate->Application;
                
$app->DisplayAlerts false;
                
$name $sheettemplate->name;
                echo 
"<br/>".$name."<br/>";
                
                for(
$u $u count($compnamearray);$u++)
                {
                    
$col_ $u +67;
                    
$colchr($col_);
                    
$cellT=$sheettemplate->Range($col."3"); 
                    
$temp =  utf8_decode($compnamearray[$u]);
                    
$cellT->value=$temp;
                }
                
$col_ ++;
                
$colchr($col_);                
                
$cellT=$sheettemplate->Range($col."3"); 
                if(
$lg=='es')
                
$temp =  utf8_decode('perfil');
                else
                
$temp =  utf8_decode('Profile');
                
$cellT->value=$temp;
                

            
        
$sql "select * from results";
        
$res mysql_query($sql);
        
//echo "<script>alert(\"hello\")</script>";
        
$lgn4;
        while(
$row mysql_fetch_row($res))
        {
            
$sql_link "select * from links where token = '".$row[1]."'";
            
//echo "<script>alert(\"$sql_link\")</script>";
            
if($res_link mysql_query($sql_link))
            {
                
///echo "<script>alert(\"$sql_link\")</script>";
                
$row_umt mysql_fetch_row($res_link);
                if(
$row_umt[2] == $team || $team == 0)
                {    
                    
                    
///////echo "<script>alert(\"$row_umt[2]\")</script>";
                    //echo "<script>alert(\"$team\")</script>";
                    
                    
connectLS();
                    
$sql "select distinct * from lime_tokens_48683 t1, lime_tokens_75547 t2 where (t1.token ='".$row[1]."' or t2.token ='".$row[1]."') and t1.token = t2.token and (t1.completed!='N' or t2.completed!='N')";
                    
$resls =mysql_query($sql);
                    if(
$rowls mysql_fetch_row($resls))
                    {
                        
                        
$t1 explode(" ",$rowls[10]);
                        
$t2 explode(" ",$rowls[24]);
                        
                        
$in_range false;
                        if ((
$t1[0]>=$date1 && $t1[0]<=$date2))
                        {
                            
$in_range true;
                        }
                        if(
$t2[0]>=$date1 && $t2[0]<=$date2)
                        {
                            
$in_range true;
                        }
                        if(
$in_range)
                        {
                            
$cellT=$sheettemplate->Range("B$lgn"); 
                            
$temp =  utf8_decode($rowls[1]." ".$rowls[2]);
                            
$cellT->value=$temp;
                            for(
$u $u count($compnamearray);$u++)
                            {
                                
$col_ $u +67;
                                
$colchr($col_);
                                
$cellT=$sheettemplate->Range($col.$lgn); 
                                
$temp =  utf8_decode($row[$u 2]);
                                if(
$temp == '-1')
                                {
                                    
$temp 'NC';
                                    
$cellT->Font->bold true;
                                    
$cellT->Font->ColorIndex=3;
                                }
                                
$cellT->value=$temp;
                            }
                            
$col_++;
                            
$colchr($col_);
                            
$cellT=$sheettemplate->Range($col.$lgn); 
                            
$temp =  utf8_decode($row[13]);
                            if(
$temp == '')
                            {
                                
$temp 'NC';
                                
$cellT->Font->bold true;
                                
$cellT->Font->ColorIndex=3;
                            }
                            
$cellT->value=$temp;
                            
$cellT->value=$temp;
                            
$lgn++;
                        }
                    }
                    
connectumt();
                }
            }
        }
                
$lgn--;
                
$cells$sheettemplate->Range("B3:N$lgn");
                
$cells->Borders->LineStyle=1;
                
$cells->Borders->Weight=2.5;
                
$cells->Borders->ColorIndex=1;
                
                
$path "C:\ReportFiles_global\Report Team ".$team." from ".$date1." until ".$date2.".xls";
                echo 
$path;
                
$booktemplate->saveas($path);
                
$app->DisplayAlerts true;
                
//Echo " Echo num 5 </br>";            
                
unset($sheettemplate);//Lib?tion de $sheet
                
unset($booktemplate);//Lib?tion de $book
                
unset($app);
                
$exceltemplate->Workbooks->Close();
                
$exceltemplate->Quit();

                unset(
$exceltemplate);

                
        return 
$path;
        
        
    }
?> 
When I use this function i get the following message :

Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft Office Excel<br/><b>Description:</b> Unable to get the SaveAs property of the Workbook class' in C:\Program Files\EasyPHP-5.3.2i\www\functions.php:166 Stack trace: #0 C:\Program Files\EasyPHP-5.3.2i\www\functions.php(166): variant->saveas('C:\ReportFiles_...') #1 C:\Program Files\EasyPHP-5.3.2i\www\Reports.php(13): make_reports('01-01-2010', '30-09-2010', 'en', '0') #2 {main} thrown in C:\Program Files\EasyPHP-5.3.2i\www\functions.php on line 166

It also seems that my excel licence is over, is it a "real" issue ?

Thanks in advance