|
发表于 2013-7-22 22:06
|
显示全部楼层
本楼为最佳答案
直接先按原文提示搜下百度:方法‘printout'作用于对象 sheets 时失败
比如这个和你的问题很像:http://zhidao.baidu.com/question/381306007.html
我觉得,可能也是因为其中有的工作簿或工作表,设置过隐藏了。因此加上蓝色这句看看?
Sub outs()
Dim files, printhit, printfile, opsheets
files = Application.WorksheetFunction.Max(Range("A:A"))
For i = 1 To files
If Cells(i + 3, 3) <> 0 Then
printhit = Cells(i + 3, 3)
printfile = Cells(i + 3, 2)
Workbooks.Open Filename:=Cells(1, 2) & "\" & Cells(i + 3, 2)
opsheets = Application.Worksheets.Count '获取工作薄中有多少个表
For x = 1 To opsheets
For j = 1 To printhit
Sheets(x).Visible = xlSheetVisible
Sheets(x).Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Next
Next
Workbooks(printfile).Close SaveChanges:=False
End If
Next
End Sub
批量打印_20130616151142b.rar
(14.87 KB, 下载次数: 3)
|
|