VBA 连续打印多个内容成PDF
python
Dim wb As Workbook
Dim sht1 As Worksheet
Set sht1 = ActiveSheet
PT = ThisWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlCalculationManual
For i = [aa2] To [ab2]
[ad2] = i
Set wb = Workbooks.Add
sht1.Copy after:=wb.Sheets(wb.Sheets.Count)
wb.Sheets(1).Delete
wb.Sheets(1).Cells.Copy
wb.Sheets(1).Cells(1, 1).PasteSpecial Paste:=xlPasteValues
wb.Sheets(1).Columns("k:af").Delete
wb.SaveAs PT & "\" & sht1.Range("y2").Value & ".xlsx"
wb.Sheets(1).ExportAsFixedFormat Type:=xlTypePDF, Filename:=PT & "\" & sht1.Range("y2").Value & ".pdf"
wb.Close False
Application.Calculation = xlCalculationAutomatic
Next
Application.ScreenUpdating = True
Application.DisplayAlerts = True