Sub dlkfjdl()
Dim MyFile As String
Dim count As Integer
MyFile = Dir("C:\Users\Administrator\Desktop\sqqk\*.*")
Debug.Print MyFile
Do While MyFile <> ""
Workbooks.Open "C:\Users\Administrator\Desktop\sqqk\" + MyFile
ActiveWorkbook.Sheets(1).Activate
With ActiveSheet.PageSetup '设置当前工作表的页面设置
.PaperSize = xlPaperA4 '设置纸张大小为A4纸
.Zoom = False
.FitToPagesWide = 1 '设置为1页宽
.FitToPagesTall = 1 '设置为1页高
End With
ActiveWorkbook.PrintOut 1, 1
Application.EnableEvents = False
ActiveWorkbook.CheckCompatibility = False '禁止自动运行兼容性检查器
ActiveWorkbook.Save '保存当前工作簙
ActiveWorkbook.Close '关闭当前工作簙
MyFile = Dir
If MyFile = "" Then Exit Do
Debug.Print MyFile
Loop
End Sub
VBA-EXCEL批量打印
最新推荐文章于 2024-05-23 16:28:12 发布