If Dir("D:\生产计画\") = "" Then
MkDir "D:\生产计画"
End If
If Dir("D:\生产计画\" & Date & ".xls") <> "" Then
Kill "D:\生产计画\" & Date & ".xls"
End If
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call Deleteit
ActiveWorkbook.Save
ActiveWorkbook.SaveAs "D:\生产计画\" & Date & ".xls"
End Sub
[此贴子已经被作者于2006-3-9 19:35:48编辑过]
作者: zyz218 时间: 2006-3-10 16:36
不知在ACCESS中可否实现?
DoCmd.CopyDatabaseFile "\\Server\noritz\MPS\Shuju.mdb",OverwriteExistingFile:=True,DisconnectAllUsers:=True
这样也不行,没有目标文件与文件名,看来DoCmd.CopyDatabaseFile 也不行???作者: 海狸先生 时间: 2006-3-10 18:27 FileCopysource,destination作者: zyz218 时间: 2006-3-10 23:46
模块:
Public Function Deleteit()
'建立文件夹
If Dir("D:\ProducePlan\") = "" Then
MkDir "D:\ProducePlan"
End If
'删除已存在的文件
If Dir("D:\ProducePlan\" & Date & ".xls") <> "" Then
Kill "D:\ProducePlan\" & Date & ".xls"
End If
End Function
当主窗体关闭时:
Private Sub Form_Close()
Call Deleteit
End Sub