在开发导出程序时,遇到Excel无法使用 SAVEAS 保存的问题。走了很多弯路。其实解决的方法很简单,在SAVEAS前把要保存的WorkBook设置为活动工作部。之后的SAVEAS就起作用了。
GET PROPERTY OF EXCEL 'ActiveWorkbook' = WORKBOOK2. "必须写上不然会出现无法自动保存的问题
GET PROPERTY
OF
EXCEL
'
ActiveWorkbook
'
=
WORKBOOK2. "必须写上不然会出现无法自动保存的问题
call method of workbook2 ' SAVEAS '
EXPORTING
# 1 = filebomi
# 2 = 1 .
call method of workbook2 ' CLOSE ' .
call method of excel ' QUIT ' .
free object sheet.
free object workbook1.
free object excel.
转自:http://blog.csdn.net/dkman803/article/details/1909569
call method of workbook2 ' SAVEAS '
EXPORTING
# 1 = filebomi
# 2 = 1 .
call method of workbook2 ' CLOSE ' .
call method of excel ' QUIT ' .
free object sheet.
free object workbook1.
free object excel.
转自:http://blog.csdn.net/dkman803/article/details/1909569