I call a power shell script from php with shell_exec
Power shell script opens an excel workbook and runs a macro
:
$excel = new-object -comobject excel.application
$excelFiles = Get-ChildItem -Path e:\dt\surgicare\something.xlsm
$app = $excel.Application
$workbook = $app.workbooks.open($excelfiles)
$app.Visible = $false
$workbook.Activate()
$app.Run("surgicare_frissites")
$workbook.close($false)
$excel.quit()
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($app)
Remove-Variable app
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($excel)
Remove-Variable excel
It can run ps script, but it returns error.
I can read in "wamp/logs/php_error.log"
that Microsoft Excel cannot open something.xlsm
.
The same error is in "wamp/logs/apache_error.log"
If I run power-shell
script manually it works fine, there is no error, macro does what it has to do.
Any idea? What did I miss?