思路很简单,根据当前列“工作类型”的内容,选择不同execl模板:
下面代码有错误,请指出bug!
不能上错误提示照片了,错误提示为
编译错误:应为语句结束
错误代码:path = "Attachments\推荐登记表.xls")
--------------------------------------------------------------------以下为我拼凑的代码
Dim dr As DataRow = Tables("推荐类型").current.DataRow
Dim path As String
If dr("推荐类型") = "民主推荐" Or dr("推荐类型") = "二次推荐" Then
path = "Attachments\推荐登记表.xls")
Else If dr("推荐类型") = "谈话推荐" Then
path = "Attachments\谈话推荐登记表.xls")
Else
msgbox("没有相应的Excel模板!")
End If
If path > "" Then
Dim Book As New XLS.Book(ProjectPath & path)
Dim fl As String = ProjectPath & "Reports\推荐登记表.xls"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Start()
End If
[此贴子已经被作者于2015/7/19 22:00:07编辑过]