20210210 1407
codes
Sub zPrint()
Sheets("report1").Activate
zpath = ActiveWorkbook.Path
zFile = zpath & "\_investment proposal.pdf"
Dim zsh_array() As String
For i = 1 To ActiveWorkbook.Sheets.Count
If Left(Worksheets(i).Name, 6) = "report" Then
znmb_report = znmb_report + 1
End If
Next i
ReDim zsh_array(1 To znmb_report)
j = 1
For i = 1 To ActiveWorkbook.Sheets.Count
If Left(Worksheets(i).Name, 6) = "report" Then
zsh_array(j) = Worksheets(i).Name
j = j + 1
End If
Next i
Sheets(zsh_array).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=zFile
Sheets("report1").Select
Range("a1").Select
End Sub
below will print multiple sheets at one shot(instead of PDF)
Sheets(Array("report1", "report2")).Select
ActiveWindow.SelectedSheets.PrintOut Printtofile:=True, _
Copies:=1, _
Collate:=True, _
IgnorePrintAreas:=False
'[PA] 업무자동화 > [XL]Excel & VBA' 카테고리의 다른 글
XL Range.Find method (0) | 2021.02.11 |
---|---|
XL copy sheets and save them as value (0) | 2021.02.11 |
XL internal data model (0) | 2021.02.08 |
XL book, Supercharge Excel when you learn to write DAX for power pivot (0) | 2021.02.08 |
XL Merge(Stack) many tables or sheets into one (pivot) table (0) | 2021.02.07 |