要在服务器端生成临时的EXCEL文件,同时要删除上一次产出的文件

写一段ASP脚本,要在服务器端生成临时的EXCEL文件,同时要删除上一次产出的文件。
问题是:文件可以生成的,但如果
插入这样的代码:myFs.DeleteFile( filePos&"\*.xls" ),要删除上一次的文件,
执行就通不过了。请大家帮忙。

Set excelApp = Server.CreateObject( "Excel.Application" )
Set workBook = excelApp.Workbooks.Add
Set workSheet = workBook.Worksheets.Item(1)

Set cell = workSheet.Cells(1, 1)
cell.Value = 5

Set myFs = Server.CreateObject( "Scripting.FileSystemObject" )
tempFile = myFs.getTempName
dotPos = instr( 1, tempFile, "." )
tempFile1 = mid( tempFile, 1, dotPos ) & "xls"
filePos = Server.MapPath("\temp")

myFs.DeleteFile( filePos&"\*.xls" )

workBook.SaveAs( filePos&""&tempFile1 )

excelApp.Quit

---------------------------------------------------------------

检查norton防毒有没有禁止脚本,如有,将其关闭

Published At
Categories with Web编程
Tagged with
comments powered by Disqus