Dim Book0 As New XLS.Book(f0)
book0.sheets.SelectedIndex = 1
book0.save(f0)
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.open(f0)
For Each Ws As MSExcel.WorkSheet In Wb.WorkSheets
ws.cells(2,2) = cj2.text
ws.UsedRange.Formula = ws.UsedRange.Formula
app.ActiveWindow.DisplayZeros = False
With Ws.PageSetup '设置打印区域
If ws.name = "资产负债表" Then
.PrintArea = "A1:I57" '打印工作表的指定区域
Else If ws.name = "利润及分配表" Then
.PrintArea = "A1:I38" '打印工作表的指定区域
Else If ws.name = "费用表" Then
.PrintArea = "A1:G40" '打印工作表的指定区域
Else If ws.name = "分单位表" Then
.PrintArea = "A1:H36" '打印工作表的指定区域
End If
End With
Next
wb.save
wb.close
App.Quit