以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- EXCEL模板打印后窗口无法关闭 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=134945) |
-- 作者:by0521 -- 发布时间:2019/5/13 15:37:00 -- EXCEL模板打印后窗口无法关闭 错误提示: .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进程。然后才能关闭窗口,还有错误提示。
|
-- 作者:有点甜 -- 发布时间:2019/5/13 16:55:00 -- Dim App As New MSExcel.Application |