|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim NowWorkbook As Workbook
Dim FileName$
p_path = "H:\tmp"
p_file = "test"
If SaveAsUI Then
FileName = Application.GetSaveAsFilename(InitialFileName:=p_path & p_file, filefilter:="Xls File,*.xls")
Cancel = True
If FileName <> "False" Then
ThisWorkbook.SaveAs FileName
End If
End If
If Not fs.fileExists(p_path & p_file & ".xls") Then
ThisWorkbook.SaveAs FileName:=p_path & p_file & ".xls" '''### 如果文件不存在保存, 会不会保存两次?
Else
ActiveWorkbook.save '''### 同样 如果文件 存在保存, 会不会保存两次?
End If
End Sub
求解惑??????? |
|