Forms("提示窗口").open
Application.DoEvents()'显示正在执行,请稍后
Dim tm As String = ProjectPath & "Attachments\处罚通知单.doc" '指定模板文件
Dim fl As String = dlg.FileName '指定目标文件
Dim wrt As New WordReport(Tables("季度大检查记录表"),tm,fl) '定义一个WordReport
Dim str As String = ""
For Each r As Row In Tables("季度大检查记录表").rows '逐行生成报表
If r("经济处罚") = "是"
str = str & vbcrlf & r("存在问题")
End If
Next
str = str.Trim(vbcr).Trim(vblf)
wrt.Replace("[存在问题]",str)
wrt.BuildOne(Tables("季度大检查记录表").current)
wrt.Quit()
Forms("提示窗口").Close