Home > Backend Development > PHP Tutorial > php执行vbs脚本解决方法

php执行vbs脚本解决方法

WBOY
Release: 2016-06-13 13:12:40
Original
1548 people have browsed it

php执行vbs脚本
vbs是打印excel文件,并执行打印操作。 使用cmd命令和直接运行vbs程序,都可进行打印。 而php调用vbs时,$returnvalue输出为0(代表执行成功),可就是不执行打印操作。 

PHP:

system("C:/print.vbs", $returnvalue);
echo $returnvalue;
?>

=====================
vbs :
templatePath="C:\2.xls"
'create object
Set oExcel=CreateObject("Excel.Application")
oExcel.DisplayAlerts = False
Set tmpExcel=oExcel.Workbooks.Open(templatePath,3,False)
oExcel.ActiveSheet.PageSetup.PrintGridLines = False 
oExcel.ActiveSheet.PrintOut
oExcel.ActiveWorkBook.Saved = False 
oExcel.Quit

------解决方案--------------------
你当人家都在 XP 下工作呀?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template