VBA 连续打印多个内容成PDF
Dim wb As Workbook
Dim sht1 As Worksheet
Set sht1 = ActiveSheet
PT = ThisWorkbook.PathApplication.ScreenUpdating = FalseApplication.DisplayAlerts = FalseApplication.Calculation = xlCalculationManual
For i = [aa2] To [ab2][ad2] = iSet wb = Workbooks.Addsht1.Copy after:=wb.Sheets(wb.Sheets.Count)wb.Sheets(1).Deletewb.Sheets(1).Cells.Copywb.Sheets(1).Cells(1, 1).PasteSpecial Paste:=xlPasteValueswb.Sheets(1).Columns("k:af").Deletewb.SaveAs PT & "\" & sht1.Range("y2").Value & ".xlsx"wb.Sheets(1).ExportAsFixedFormat Type:=xlTypePDF, Filename:=PT & "\" & sht1.Range("y2").Value & ".pdf"wb.Close FalseApplication.Calculation = xlCalculationAutomatic
NextApplication.ScreenUpdating = TrueApplication.DisplayAlerts = True