紧急:如何批量打印直接打印word报表,不预览;按照选择的行,批量直接打印word报表
Dim tm As String = ProjectPath & "Attachments\人员简历表.doc" '指定模板文件
With Tables("员工资料")
If .TopPosition > -1 Then '如果选定区域包括数据行
For i As Integer = .TopPosition To .BottomPosition
Dim r As Row = .Rows(i)
Dim fileName As String = ProjectPath & "Reports\"& r("姓名") &".doc" '指定目标文件
Dim wrt As New WordReport(Tables("员工资料"),tm,fileName) '定义一个WordReport
wrt.BuildOne(r)
Dim app As New MSWord.Application
try
app.Documents.Open(fileName)
'app.Documents(fileName).PrintPreview
'app.Visible = True
app.Documents(fileName).PrintOut '打印
catch ex As exception
msgbox(ex.message)
finally
app.Quit
End try
Next
End If
End With
[此贴子已经被作者于2015/9/9 13:18:48编辑过]