呃,都可以
Dim dr As Row = Tables("表A").Current
If dr("客户简称") = "A客户" Then
Dim Book As New XLS.Book(ProjectPath & "Attachments\A客户合同明细.xls")
Dim fl As String = ProjectPath & "Reports\QD" & Format(Date.Today,"yyyyMMdd") & ".xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Sheet(4,14).Value = "A" & Format(Date.Today, "yyMMdd") '写入合同编号
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Start()
Else
Dim Book As New XLS.Book(ProjectPath & "Attachments\B客户合同明细.xls")
Dim fl As String = ProjectPath & "Reports\QD" & Format(Date.Today,"yyyyMMdd") & ".xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Sheet(4,14).Value = "B" & Format(Date.Today, "yyMMdd") '写入合同编号
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Start()
End If