Hello Jenkins,
I tried searching for excel API call and got a code like this:
-
<?php
-
// set up excel
-
$excel = new COM(”excel.application”) or die(”Unable to instantiate excel”);
-
// run Excel silently, since we don’t want dialog boxes popping up in the background
-
$excel->DisplayAlerts = false;
-
// open up Excel file and select the first sheet, which contains the inputs
-
$excel->Workbooks->Open(”model.xls”);
-
$book = $excel->ActiveWorkbook;
-
$sheets = $book->Sheets;
-
$sheet = $book->Worksheets(1);
-
-
// input stuff into excel spreadsheet
-
for ($i = 0; $i < count($_POST[input]); $i++) {
-
$cell = $sheet->Cells(1, $i + 1);
-
$cell->Activate;
-
$cell->value = $input[$i];
-
}
-
-
// run macro
-
$excel->Run(”runModel”);
-
-
// save spreadsheet
-
$book->SaveAs(”model.xls”);
-
-
// quit Excel and clean up
-
$book->Close(false);
-
unset($sheets);
-
$excel->Workbooks->Close();
-
unset($book);
-
$excel->Quit;
-
unset($excel);
-
-
I modified the above code to suit my code like this
-
$book = $workbook->ActiveWorkbook;
-
$sheets = $book->Sheets;
-
-
$workbook->Run("TTS_PROJECT_REPORT_MACRO.xls");
-
$book->SaveAs($filename.".xls");
-
$workbook->close();
-
I avoided calling COM as it is giving error to me.Even then the code is not working.It is giving an error saying RUN is a non-existent function.
Can you please help with this?
Any other suggestions are welcome.
Thanks&Regards,
Shara.
Quote:
Originally Posted by shara
Hello Jenkins,
This is a dynamic report that affects a substantial amount of users.I'll try the proposed.
Thanks for your help.
Regards,
Shara.