错误提示:
.NET Framework 版本:2.0.50727.9035
Foxtable 版本:2018.10.9.1
错误所在事件:窗口,打包标签模板,Button2,Click
详细错误信息:
远程过程调用失败。 (异常来自 HRESULT:0x800706BE)
Button2 的代码如下
Dim Book As New XLS.Book(ProjectPath & "Attachments\打包标签模板.xls")
Dim fl As String = ProjectPath & "Reports\打包标签模板.xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
With Ws.PageSetup
.LeftMargin = 2
.RightMargin = 2
.TopMargin = 1
.BottomMargin = 1
.CenterHorizontally = True
.CenterVertically = True
.Zoom = False
.FitToPagesTall = 1
End With
Ws.PrintOut (Copies:= 3 ,ActivePrinter:="POSTEK C168/300s ")
Wb.Close
App.Quit
点击button2后,标签打印出来了,但是窗口无法关闭,得要从任务管理器里面 结束EXCEL进程。然后才能关闭窗口,还有错误提示。