老师,
您好!
麻烦你帮忙看下以下代码问题出在哪?点击打印时总是报错: 提示表格已打开, 请先关闭之!
Select Case MainTable.name
Case "订单要求"
Dim Tablename As String
Dim Filename As String
Tablename= CurrentTable.name
Filename=Tablename & "." & "xlsx"
Dim Book As New XLS.Book(ProjectPath & "Attachments\"& Filename &"")
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
Dim fl As String = ProjectPath & "Reports\"& Filename &""
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 = Wb.UsedRange
rg.Formula = rg.Formula
Rg.WrapText = True
Rg.EntireColumn.AutoFit '自动调整列宽
Rg.EntireRow.AutoFit '自动调整行高
app.visible = True
End Select