Dim Book As New XLS.Book(ProjectPath & "Attachments\冲压制令单.xls")
Dim fl As String = ProjectPath & "Reports\冲压制令单.xls"
With Tables("冲压生产计划追踪表")
If .TopPosition > -1 Then '如果选定区域包括数据行
For i As Integer = .TopPosition To .BottomPosition
book.AddDataTable("冲压生产计划追踪表","wjexcel","Select * f ro m {冲压生产计划追踪表} where 制令单号 = '" & .Rows(i)("制令单号") & "'") '添加父表
book.AddDataTable("Ft生产制令单","wjexcel","Select * f ro m {Ft生产制令单} where 销售单号 = '" & .Rows(i)("制令单号") & "'") '添加子表
book.AddRelation("冲压生产计划追踪表","制令单号","Ft生产制令单","销售单号") '建立关联
Book.Build() '生成细节区
fl = ProjectPath & "Reports\" & .Rows(i)("制令单号") & ".pdf"
'Book.Save(fl) '保存工作簿
Book.SaveToPDF(fl) '保存为PDF文件
'Dim Proc As New Process '打开工作簿
'Proc.File = fl
'Proc.Start()
Next
End If
End With
以上代码,选择多行,提示如下错误
此主题相关图片如下:qq截图20170908163959.png