增加一个判断语句,当存在相同文件名文件时,提示“已存在相同文件,是否覆盖”按“是”覆盖 按“否”取消,只打开已存在的文件。
Dim Book As New XLS.Book(ProjectPath & "Attachments\告知书.xls")
Dim fl As String = ProjectPath & "Reports\告知书.xls"
Book.Build() '生成细节区
Dim fl2 As String = ProjectPath & "告知书\" & Tables("基本信息表").Current("出厂编号") & "告知书.xls"
If FileSys.FileExists(f12) Then
Dim Result As DialogResult
Result = MessageBox.Show("存在相同文件!","是否覆盖", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
FileSys.CopyFile(fl, fl2,True)
Dim Proc As New Process '打开工作簿
Proc.File = fl2
Proc.Start()
Else
Dim Proc As New Process '打开工作簿
Proc.File = fl2
Proc.Start()
End If
Else
FileSys.CopyFile(fl, fl2,True)
Dim Proc As New Process '打开工作簿
Proc.File = fl2
Proc.Start()
End If
哪里错了,是不是这句:If FileSys.FileExists(f12) Then
[此贴子已经被作者于2016/5/7 13:47:15编辑过]