我编写了一个从 excel 生成报告的 foxpro 程序。在最后的过程中,程序生成了两(2)个excel。我创建了一个新工作簿并将两个输出 excel 表复制到新工作簿中。如何关闭这两个excel文件?
我的代码
**creating new workbook
XL = tmp.application
XL.workbooks.ADD()
XL.visible = .T.
XLsheet = XL.ActiveSheet
**opening the aging excel output
sheetdir=SYS(5)+SYS(2003)+"\temp\EXCEL1.xls"
XL.workbooks.OPEN(sheetdir)
XL.worksheets.COPY(XLsheet)
XL.ActiveSheet.UsedRange.EntireColumn.Autofit
XL.ActiveSheet.name="P1"
xl.cells(1,1).value="xx"
XLsheet = XL.ActiveSheet
**opening the unvalidated excel output
sheetdir=SYS(5)+SYS(2003)+"\temp\EXCEL2.xls"
XL.workbooks.OPEN(sheetdir)
XL.worksheets.COPY(XLsheet)
XL.ActiveSheet.UsedRange.EntireColumn.Autofit
XL.ActiveSheet.name="P2"