判断一个文件是否存在需要用FileSystemObject:
sSourceFile="C:\Source.xls"
set fso=CreateObject("Scripting.FileSystemObject")
xlApp=CreateObject("Excel.Application")
bFileExist=fso.FileExists(sSourceFile)
if bFileExist then
set xlWorkbook=xlApp.workbooks.open(sSourceFile)
else
xlWorkbook=xlApp.workbooks.add
end if
'判断是否打开一个new file
if bFileExist then
xlWorkbook.save
else
xlWorkbook.saveas sSourceFile
end if