1、模板有问题,这个要去掉 <是否打印=true>
2、代码改一下
Dim s As String ="上海分公司"
Dim s1 As String ="南京分公司"
Dim s2 As String ="广东分公司"
For Each R2 As Row In Tables("出库录入窗口_出库明细表").GetCheckedRows
If r2("库位")<>Nothing AndAlso R2("产品ID")<>Nothing Then
Dim Book As XLS.Book
If R2("发货货权")=s1 Then
book = New XLS.Book(ProjectPath & "Attachments\南京开单.xls")
ElseIf R2("发货货权")=s Then
book = New XLS.Book(ProjectPath & "Attachments\上海开单.xls")
ElseIf R2("发货货权")=s2 Then
book = New XLS.Book(ProjectPath & "Attachments\广州开单.xls")
End If
Dim fl As String = ProjectPath & "Reports\出库单.xls"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Verb= "Print"
Proc.Start()
R2("已打印")=True
Else
MessageBox.Show("请选择库位后再打印!","提示:")
End If
R2.Checked =False
Next