以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 总提示计量单没有关闭,不知道我写代码为啥没有效果 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=120052) |
-- 作者:xxfoxtable -- 发布时间:2018/6/6 11:02:00 -- 总提示计量单没有关闭,不知道我写代码为啥没有效果 Dim Book As New XLS.Book(ProjectPath & "Attachments\\计量单.xls") Dim Sheet As XLS.Sheet = Book.Sheets(0) \'引用工作簿的第一个工作表 Dim fl As String = ProjectPath & "Reports\\计量单.xls" Book.Build() \'生成细节区 Dim App As New MSExcel.Application Dim Wb As MSExcel.WorkBook =App.WorkBooks.Open(fl) Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1) Dim Rg As MSExcel.Range = Ws.Range("C:C") rg.Formula = rg.Formula Dim Copyfl As String = "D:\\按户计量单\\" & Tables("汇报表").Current("村名称") & "(村)" & Tables("汇报表").Current("村寨名") & "(自然寨)" & Tables("汇报表").Current("组别") & "按户计量单" & ".xls" FileSys.CopyFile(fl, copyfl, True) Book.Save(fl) \'保存工作簿 wb.close app.quit wb.close不是关闭计量单吗? Book.Save(fl) \'保存工作簿有这条语句也提示,是不是对计量单保存更改
[此贴子已经被作者于2018/6/6 11:07:32编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/6/6 11:10:00 -- Dim Book As New XLS.Book(ProjectPath & "Attachments\\计量单.xls") Dim Sheet As XLS.Sheet = Book.Sheets(0) \'引用工作簿的第一个工作表 Dim fl As String = ProjectPath & "Reports\\计量单.xls" 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) Dim Rg As MSExcel.Range = Ws.Range("C:C") rg.Formula = rg.Formula wb.save wb.close app.quit Dim Copyfl As String = "D:\\按户计量单\\" & Tables("汇报表").Current("村名称") & "(村)" & Tables("汇报表").Current("村寨名") & "(自然寨)" & Tables("汇报表").Current("组别") & "按户计量单" & ".xls" FileSys.CopyFile(fl, copyfl, True) |