我们在做web项目时,有时会需要在线生成Excel文件。本文教大家asp创建Excel文件的方法。
下面是编写好的函数代码:
Function CreateExcelFile(fileFullPath)
Set ExcelApp = CreateObject("Excel.Application") '创建EXCEL对象
Set ExcelBook = ExcelApp.Workbooks.Add
Set ExcelSheet = ExcelBook.Worksheets(1) 'add worksheet
ExcelSheet.Activate
ExcelApp.DisplayAlerts = False
ExcelSheet.Name="sheet1"
ExcelBook.SaveAs fileFullPath '保存工作表
ExcelBook.close
set excelApp=nothing
set ExcelBook=nothing
set ExcelSheet=nothing
End Function
fileFullPath参数代表Excel文件保存的路径。
声明:如需转载,请注明来源于www.webym.net并保留原文链接:http://www.webym.net/jiaocheng/535.html





















